View Full Version : Invoke a Javascript Function - Help

03-22-2010, 08:04 AM
I have got a funny html page that will run Javascript via different invokes but not between <script> tags.

It's a simple function with a 1 second timer.

If I invoke the script via body onload it runs e.g.

<body onload="count();">

If I invoke via a input button it runs e.g.

<input type="button" value="Start Count" onclick="count()" />

if I invoke via script tags it does not run and there is no error message or output. e.g.

<script type="text/javascript" language="JavaScript">

The page I am working with is auto generated and all the dynamic code is from a MySQL database and placed in the page via a templating system, there I do not have access to the body tag so I can not use body onload event to trigger the count.

Currently I am using the input button to invoke the javascript count function but do need to use the script tags instead.

Can anyone shed a light as to why the invoke works but not via script tags.


PS, in a new blank html page the javascript script tags invoke the javascript count function perfectly as it should do.