View Single Post
Old 02-18-2025, 03:03 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,073
Karma: 6361556
Join Date: Nov 2009
Device: many
Yes, without the onload to actually invoke your javascript function you would have to manually invoke it someplace just before the ending body tag:

Something like:

Code:
...
  <script type="application/javascript" src="../Misc/Script0001.js" ></script>
</head>

<body>
  <p>this is some text.  This more text.  Try another type of texting.</p>
  <p>this is some text.  This more text.  Try another type of texting.</p>
  <p>this is some text.  This more text.  Try another type of texting.</p>
  <script type="application/javascript">init()</script>
</body>
...
But using onload to invoke the function you linked in is much nicer.

Alternatively you could instead add the call to invoke init() to the end of the script itself and then link in the script not in head but instead just before the body close tag.

But in my opinion Doitsu's approach is the best/most compliant.

Last edited by KevinH; 02-18-2025 at 03:22 PM.
KevinH is offline   Reply With Quote