sg

Çarşamba, Aralık 07, 2005

Re: Multiple Keys


It's possible to check the value of window.location.host in Javascript,
and document.write() the code that uses the corresponding key back into
your HTML.

There's a trick to it, because <script> and </script> are magic words in
Javascript. You can't use them inside a quoted string. So you have to
write '<'+'script>' and '<'+'script>' like this:

<script type="text/javascript">

var key1 = '<' + 'script src="http://maps.google.com/maps?'
+ 'file=api&v=1&key=xxxxxxxxxx" type="text/javascript">'
+ '<' +'/script>';

var key2 = '<' + 'script src="http://maps.google.com/maps?'
+ 'file=api&v=1&key=yyyyyyyyyy" type="text/javascript">'
+ '<' +'/script>';

if (window.location.host == 'www.mydomain01.com') {
document.write(key1);
}
else {
document.write(key2);
}
</script>
--
Another quick fix from
The Blackpool Community Church Javascript Team
http://www.econym.demon.co.uk/googlemaps/

0 Comments:

Yorum Gönder

<< Home


Komik Videolar   islam  şarkı sözleri  yemek tarifleri  gelibolu  huzur   sağlık