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

"onload" event

  • Robert Fant
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 9 ans 6 mois #4200 par Robert Fant
"onload" event a été créé par 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

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 6 mois #4202 par Fay
Réponse de Fay sur le sujet "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.

Connexion ou Créer un compte pour participer à la conversation.

  • Robert Fant
  • Auteur du sujet
  • Hors Ligne
  • Nouveau membre
  • Nouveau membre
Plus d'informations
il y a 9 ans 6 mois #4204 par Robert Fant
Réponse de Robert Fant sur le sujet "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,

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 6 mois #4205 par ronm
Réponse de ronm sur le sujet "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/
Les utilisateur(s) suivant ont remercié: Robert Fant

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 6 mois #4206 par Fay
Réponse de Fay sur le sujet "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?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 6 mois #4207 par tom
Réponse de tom sur le sujet "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.

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: ingdon
Temps de génération de la page : 1.152 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo