General questions and topics about Xerte Toolkits that don’t fit anywhere else.

"onload" event

  • Robert Fant
  • Onderwerp Auteur
  • Offline
  • Nieuw lid
  • Nieuw lid
Meer
9 jaren 6 maanden geleden #4200 door Robert Fant
"onload" event werd gestart door Robert Fant
The "onload" event is often placed in the <body> tag, or various other tags.
I'm wanting to run a script when a page is loaded, but unfortunately I can't figure out where to place it in my various pages.

Your assistance is greatly appreciated.

Thanks,
Robert

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
9 jaren 6 maanden geleden #4202 door Fay
Beantwoord door Fay in topic "onload" event
Every page has a 'script' optional property that you can add. Any javascript added to this field will be executed after the page has been loaded for the 1st time.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

  • Robert Fant
  • Onderwerp Auteur
  • Offline
  • Nieuw lid
  • Nieuw lid
Meer
9 jaren 6 maanden geleden #4204 door Robert Fant
Beantwoord door Robert Fant in topic "onload" event
Hi Fay,

Yes, I am aware of the JavaScript property.
However, the "onload" command/attribute (whatever) does not stand-alone, it is generally placed inside a tag such as,

<body onload="MyScript()" >

so when the body (document) is loaded, the MyScript function is called.

I need an alternative method of getting my script to run as soon as I open that particular page.

Thanks,

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
9 jaren 6 maanden geleden #4205 door ronm
Beantwoord door ronm in topic "onload" event
In the script text box just add MyScript();

Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/
De volgende gebruiker (s) zei dank u: Robert Fant

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
9 jaren 6 maanden geleden #4206 door Fay
Beantwoord door Fay in topic "onload" event
Do you need it to run before anything else on the page is set up? If so then I don't think there is a way of doing this at the moment (although I would like to look at better scripting support at some point).

Can't you just put your MyScript function in the optional property field and call it from there?

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
9 jaren 6 maanden geleden #4207 door tom
Beantwoord door tom in topic "onload" event
I am not sure which 'pages' you're referring to, but I suspect pages in a Xerte Online Toolkits LO.

Please do realsie that there is only one body element, and that all the content is loaded dynamically, so onload in body wouldn't wordk in this case.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: ingdon
Tijd voor maken pagina: 0.400 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo