how to get page load event

how to get page load event

Alpesh Mistry -
回帖数:9
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?

回复Alpesh Mistry

Re: how to get page load event

Dale Davies -
Particularly helpful Moodlers的头像 Plugin developers的头像
Can you not call pageload() in the footer?
回复Dale Davies

Re: how to get page load event

Alpesh Mistry -

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.
回复Alpesh Mistry

Re: how to get page load event

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
Use the YUI on DOM ready event.
回复Tim Hunt

Re: how to get page load event

Alpesh Mistry -

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.

回复Alpesh Mistry

Re: how to get page load event

Paul Holden -
Core developers的头像 Moodle HQ的头像 Moodle Workplace team的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像
See this post and it's parent thread - your question is probably answered there approve
回复Paul Holden

Re: how to get page load event

Alpesh Mistry -
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
回复Alpesh Mistry

Re: how to get page load event

Dale Davies -
Particularly helpful Moodlers的头像 Plugin developers的头像
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.