I would like to explain my situation.
I am writing a website and one of the webpage is using the google map.
The web site is a cms
website and it is using ektron
So, I have to use ektron google map
coz it provides some features that the customers want.
Ektron
is simply using google map
and use ajax to combine with its own logic.
I dun know the details but whenever I tried to change the properties of that ektron map
, I need to click search
or zoom in
or zoom out
or move the map.
Only after I do that, the properties changed are effected. If not, they don't.
So, I think of the shortcut and programatically cick the search
button of ektron map
.
Then again, I am adding the control programatically to a panel
.
I can't write document.ready
coz I found out that works before the map is loaded.
So, I wrote this code to make the map works.
<script type="text/javascript">
$(window).load(function () {
$("#__GetAddr").click();
});
</script>
It works. __GetAddr
is the search button ID and I click it after everything loads.
But the problem started when I use it with chrome.
I found out that $(window).load()
is not working in chrome, safari and opera.
I googled it for a while but can't find any solid answer.
Is there any clear alternative way for that to work in those 3 browsers while it still works for IE7,8,9 and Firefox.
Thanks a lot.
Hi all, I have a solution.
I dun think it's the best solution. but it works.
<script type="text/javascript">
if (navigator.appName == "Microsoft Internet Explorer") {
$(window).load(function () { $("#__GetAddr").click(); });
}
else {
window.addEventListener('load', function () { $("#__GetAddr").click(); }, false);
}
</script>
I would appreciate to have a better one. :P
<script type="text/javascript">
if (navigator.appName == "Microsoft Internet Explorer") {
$(window).load(function () { $("#__GetAddr").click(); });
} else {
window.addEventListener('load', function () { $("#__GetAddr").click(); }, false);
}
</script>