how to get page load event

how to get page load event

Alpesh Mistry -
Vastausten määrä: 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?

Arviointien keskiarvo: -
Vastaus Alpesh Mistry

Re: how to get page load event

Dale Davies -
Kuva: Particularly helpful Moodlers Kuva: Plugin developers
Can you not call pageload() in the footer?
Vastaus 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.
Vastaus Alpesh Mistry

Re: how to get page load event

Tim Hunt -
Kuva: Core developers Kuva: Documentation writers Kuva: Particularly helpful Moodlers Kuva: Peer reviewers Kuva: Plugin developers
Use the YUI on DOM ready event.
Vastaus 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.

Vastaus Alpesh Mistry

Re: how to get page load event

Paul Holden -
Kuva: Core developers Kuva: Moodle HQ Kuva: Moodle Workplace team Kuva: Particularly helpful Moodlers Kuva: Peer reviewers Kuva: Plugin developers Kuva: Testers
See this post and it's parent thread - your question is probably answered there approve
Vastaus 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
Vastaus Alpesh Mistry

Re: how to get page load event

Dale Davies -
Kuva: Particularly helpful Moodlers Kuva: 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.