hi
i trying to find how can we get the page load event in moodle.
what want is i create a one page that using moodle api like print_header,print_footer etc.
when this page load i want to call one javascript function named pageload()
so how can i do this.
i found that if i write in html page like this
<body onclick="pageload()">
then it will work but in moodle how can i do it?
Can you not call pageload() in the footer?
I want to call my own java script function in the page load of a php page, In simple html page we can do the same by just calling fuction in <body>, "onload" event, how can we do this in moodle system?
as i cannot see body tag anywhere in php page.
Thanks for the help.
Use the YUI on DOM ready event.
thanks for reply
Tim
i tried to find it but i don't get it.
if you explain more about DOM ready event.
if possible then give me example of it.
See this post and it's parent thread - your question is probably answered there

hi
i tried but didn't get the solution if any body know then please tell me its urgent.
i want to call javascript function as page loaded on client pc
i tried but didn't get the solution if any body know then please tell me its urgent.
i want to call javascript function as page loaded on client pc
In your PHP code somewhere do
require_js('yui_dom-event');
require_js('myscripts.js');
Then in myscripts.js, do something like
function init_my_feature() {
// Whatever.
}
YAHOO.util.Event.onDOMReady(init_my_feature);
Development:JavaScript_guidelines and
http://developer.yahoo.com/yui/event/ should help you understand this.
require_js('yui_dom-event');
require_js('myscripts.js');
Then in myscripts.js, do something like
function init_my_feature() {
// Whatever.
}
YAHOO.util.Event.onDOMReady(init_my_feature);
Development:JavaScript_guidelines and
http://developer.yahoo.com/yui/event/ should help you understand this.
Alpesh, look for your theme's header.html or footer.html file. This can be found in the "theme" directory. You will find the body tag opened in the header file and closed in the footer file.
thanks to all.
i got the solution.
thanks again
i got the solution.
thanks again