Normally there are two ways to run javascipt when html page is loaded:
The problem of method 2) is that when the function started, maybe the html document is not fully loaded.
FIX
===============================
To solve this, 'domready' from mootools helps a lot and improves the loading speed very much. See domready vs load.
Insert mootool.js (optional for Joomla, But required for local html test)
---------------------------------------------------
---------------------------------------------------
You should go to mootools.net to download the latest mootools.js.
- window.onload=INLINE_FUNCTION_NAME, is normally used to make specific javascript runnable when the html document is loaded.
- general javascript function, like "function FUNCTION_NAME() {... }; FUNCTION_NAME();"
The problem of method 2) is that when the function started, maybe the html document is not fully loaded.
FIX
===============================
To solve this, 'domready' from mootools helps a lot and improves the loading speed very much. See domready vs load.
Insert mootool.js (optional for Joomla, But required for local html test)
---------------------------------------------------
<script type="text/javascript" src="mootools.js">
</script>
---------------------------------------------------
You should go to mootools.net to download the latest mootools.js.
No comments:
Post a Comment