window.setInterval() not working in Mozilla 1.7.1

E

Eli

Hello all,
I have just added a small piece of JavaScript code to a basic HTML
page of mine. At the end of the page (after the closing </HTML>) I
added:

<SCRIPT LANGUAGE="JavaScript">
window.setInterval ("myFunc()", 1000);
</SCRIPT>

The function myFunc is as easy as you might expect, to update a text
field with the current time.
Things go fine under IE6 but not working under Mozilla 1.7.1, both
under Win XP. For Mozilla 1.7.1:
1. navigator.appName is showing Netscape
2. navigator.userAgent is showing Mozilla/5.0
My book references say window.setInterval () is avail from Netscape 4.
Any ideas? TIA.

Eli
 
M

Martin Honnen

Eli wrote:


At the end of the page (after the closing </HTML>) I
added:

<SCRIPT LANGUAGE="JavaScript">
window.setInterval ("myFunc()", 1000);
</SCRIPT>

The function myFunc is as easy as you might expect, to update a text
field with the current time.
Things go fine under IE6 but not working under Mozilla 1.7.1, both
under Win XP.

Check Mozilla's JavaScript console, I suspect the myFunc throws an error.
If you can't correct it yourself post the relevant code.
 
L

Lee

Eli said:
Hello all,
I have just added a small piece of JavaScript code to a basic HTML
page of mine. At the end of the page (after the closing </HTML>) I
added:

<SCRIPT LANGUAGE="JavaScript">
window.setInterval ("myFunc()", 1000);
</SCRIPT>

The function myFunc is as easy as you might expect, to update a text
field with the current time.
Things go fine under IE6 but not working under Mozilla 1.7.1, both
under Win XP. For Mozilla 1.7.1:
1. navigator.appName is showing Netscape
2. navigator.userAgent is showing Mozilla/5.0
My book references say window.setInterval () is avail from Netscape 4.
Any ideas? TIA.

I would bet that you're trying to update the text field using
something like:

myFormName.myFieldName.value = "whatever";

which is using an unsafe shortcut that IE supports, but many
other browsers do not. Use the full reference:

document.myFormName.myFieldName.value = "whatever";

The following are not responsible for your problem, but may
indicate that you should find a better book:

1. You should not place <script> blocks after the closing </html>
They should be within the <head> or <body> blocks.

2. The <script> tag should be:

<script type="text/javascript">

The "language" attribute is out-dated.
 
E

Eli

Heaps of thanks Martin.
Mozilla's JavaScript Console is a great help indeed. Totally new for me.
Problem solved.
All the best,
Eli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top