-
When the location you want is in the center of the map, copy and paste this code into the location bar of your browser and press enter
-
javascript:void(prompt(”,gApplication.getMap().getCenter()));
-
-
This little trick allows a Flash movie (swf) to find out the URL of the page in which it’s embedded. Javascript must be enabled for this to work. if the window.location.href.toString method doesn’t return a value then ExternalInterface.call will return null. Same thing happens when Javascript is disabled.
-
// This little trick allows a Flash movie (swf) to find out the URL of the page in which it’s embedded.
-
import flash.external.ExternalInterface;
-
var pageURL:String =
-
ExternalInterface.call(‘window.location.href.toString’);
-
-
if toFixed is not defined
-
if (!num.toFixed)
-
{
-
Number.prototype.toFixed = function(precision) {
-
var power = Math.pow(10, precision || 0);
-
return String(Math.round(this * power)/power);
-
}
-
}
-
// OR
-
Number.prototype.toFixed = function(precision)
-
{
-
var num = (Math.round(this*Math.pow(10,precision))).toString();
-
return num.substring(0,num.length-precision) + “.” +
-
num.substring(num.length-precision, num.length);
-
}
-
-
-
anchor = window.location.hash;
-
anchor = anchor.substring(1,anchor.length); // enleve le #
-
//– Juste pour l’archivage, voici le code que j’utilisais avant de savoir qu’une fonction js existait
-
var url = document.location.toString();
-
if (myFile.match(‘#’)) {
-
var anchor = myFile.split(‘#’)[1];
-
}
-
-
-
// Le JS dans la div ci-dessous a été inséré par une requete AJAX
-
// <div id=’mydiv’> <script type=’text/javascript’> […] </script> </div>
-
var div = document.getElementById(‘mydiv’);
-
div.innerHTML = innerHTML;
-
var x = div.getElementsByTagName(“script”);
-
for(var i=0;i<x.length;i++)
-
{
-
eval(x[i].text);
-
}
-
-
-
var myfunc = function(optional) {
-
if (typeof optional == “undefined”) {
-
optional = “default value”;
-
}
-
alert(optional);
-
}
-
-
-
$.create = function() {
-
var ret = [], a = arguments, i, e;
-
a = a[0].constructor == Array ? a[0] : a;
-
for(i=0; i<a.length; i++) {
-
if(a[i+1] && a[i+1].constructor == Object) { // item is element if attributes follow
-
e = document.createElement(a[i]);
-
$(e).attr(a[++i]); // apply attributes
-
if (a[i] == ‘table’) alert (‘titi’);
-
if(a[i+1] && a[i+1].constructor == Array) $(e).append($.create(a[++i])); // optional children
-
ret.push(e);
-
} else { // item is just a text node
-
ret.push(document.createTextNode(a[i]));
-
}
-
}
-
return ret;
-
};
-
// Usage
-
$.create(
-
‘table’, { ‘class’:“MyTable” }, [
-
‘tbody’, {}, [
-
‘tr’, { ‘class’:“MyTableRow” }, [
-
‘td’, { ‘class’:“MyTableCol1” }, [ “howdy” ],
-
‘td’, { ‘class’:“MyTableCol2” }, [
-
“Link:”, ‘a’, { ‘class’:“MyLink”, ‘href’:“http://www.example.com” }, [“example.com”] ] ],
-
‘tr’, { ‘class’:“MyTableRow2” }, [
-
‘td’, { ‘class’:“MyTableCol1” }, [ “howdy” ],
-
‘td’, { ‘class’:“MyTableCol2” }, [
-
“Link:”, ‘a’, { ‘class’:“MyLink”, ‘href’:“http://www.example.com” }, [“example.com”] ] ] ] ]);
“javascript” related tags
spirit’s tags
-