This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, March 3, 2010

Get latitude and longitude from Google maps

Open the map using post code or whtever u want to use.

then paste this in ur browser location bar:

javascript:void(prompt('',gApplication.getMap().getCenter()));



 



http://lifehacker.com/267361/how-to-find-latitude-and-longitude

Monday, January 11, 2010

document.createElement not working on Firefox

document.createElement was working in all browsers other than FF.I changed this part

   1: var newElement = document.createElement("<input name='"+elementName+"' id='" + elementName + "' type='hidden'>");


to this:




   1: var newElement = document.createElement("input");



   2:  newElement.setAttribute('name',elementName);



   3:  newElement.setAttribute('id',elementName);



   4:  newElement.setAttribute('type','hidden');


and i got it working in all browsers


http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/


http://www.eggheadcafe.com/community/aspnet/3/41127/firefox-createelement--a.aspx

Wednesday, January 6, 2010

Call server side methods from client side

I know of some ways to do the above but this was really one of the simplest ways to do it.

http://usmanshabbir.blogspot.com/2009/10/simplest-way-to-call-server-side.html

Tuesday, October 20, 2009

Javascript to assign CSS on the basis of browser

<script language="JavaScript"><br /><!-- var browser = ''; var version = ''; var entrance = ''; var cond = ''; // BROWSER? if (browser == ''){ if (navigator.appName.indexOf('Microsoft') != -1) browser = 'IE' else if (navigator.appName.indexOf('Netscape') != -1) browser = 'Netscape' else browser = 'IE'; } if (version == ''){ version= navigator.appVersion; paren = version.indexOf('('); whole_version = navigator.appVersion.substring(0,paren-1); version = parseInt(whole_version); } //if (browser == 'IE' && version <= 6) document.write('<'+'link rel="stylesheet" href="oldstyle_ie.css" />');<br />if (browser == 'IE' && version > 6) document.write('<'+'link rel="stylesheet" href="css/ie7.css" />');<br />else document.write('<'+'link rel="stylesheet" href="css/white-master.css" media="screen, projection" />');<br />//if (browser == 'Netscape' && version >= 2.02) document.write('<'+'link rel="stylesheet" href=" style.css" />');<br />// --><br /></script>

Wednesday, July 15, 2009

Accessing web.config key using javascript

I was using this way to get web.config key value in javascript:


but i got this error:

Too many characters in character literal

because my string was very long. So I used this way instead:


Another way:



Add javascript & HTML in Blogger posts

http://share-useful-links.blogspot.com

Use the HTML Parser to convert your code, and then post in blogger :)

Get form hidden variable value from outside the IFrame

An iframe contains a form with a hidden variable (input type =" hidden">and I needed to access this hidden variable in the parent page which contains the Iframe, here is how I did it:


but it didnt work for every website, on some it gave the javascript permission denied error:

Get Current URL of an Iframe

http://forums.devarticles.com/programming-tools-11/how-do-i-get-the-url-of-an-iframe-11460.html - Useful for me in some cases

Javascript string functions

http://www.w3schools.com/jsref/jsref_obj_string.asp