Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Wednesday, July 7, 2010

Use Firebug and Yslow plugins for Firefox to know the performancd of the page load

Use Firebug for Firefox from a realistic net connection to see a graphical timeline of what it is doing during a page load. This shows where Firefox has to wait for one HTTP request to complete before starting the next one and how page load time increases with each object loaded. YSlow extends Firebug to offer tips on how to improve your site's performance

Tuesday, June 29, 2010

Open new tab in browser using js

//open new tab with blank address
window.open('', '_blank', 'toolbar=0,location=0,menubar=0');

//open new tab with url
window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');

Monday, February 15, 2010

Open multiple urls at a time

To open multiple windows at a time use the below code in Javascript
window.open('http://www.yahoo.com');
window.open('http://www.gmail.com');

take the above lines in one js function and call the function when you want to open yahoo and google at a time in two different tabs.

Friday, November 6, 2009

Googlemap show Directions between two places

Place the below js code in head tag
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(42.351505,-71.094455),12);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from:kakinada,india to:Kurnool,india");
}
Place the two divs in html body with ids map_convas, route
Call onload="initialize()" onunload="GUnload()" in body tag.
directions.load("from:kakinada,india to:Kurnool,india");
here you you can also place lat,long pairs in place of from and two address

Friday, July 17, 2009

How to clear file upload field value using js

We can't assign or remove value through js for file upload field. We can remove value only through reset button only.
But we can do it simply as below.
First take that file field in div or any other container tags like span etc.,
and in js give that div's innerHTML as input type="file" name="img". So new file upload element is created within that div.