Connecting Tech Pros Worldwide Help | Site Map

window.setInterval() not working in Mozilla 1.7.1

Eli
Guest
 
Posts: n/a
#1: Jul 23 '05
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
Martin Honnen
Guest
 
Posts: n/a
#2: Jul 23 '05

re: window.setInterval() not working in Mozilla 1.7.1




Eli wrote:


[color=blue]
> 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.[/color]

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

--

Martin Honnen
http://JavaScript.FAQTs.com/
Lee
Guest
 
Posts: n/a
#3: Jul 23 '05

re: window.setInterval() not working in Mozilla 1.7.1


Eli said:[color=blue]
>
>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.[/color]

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.

Eli
Guest
 
Posts: n/a
#4: Jul 23 '05

re: window.setInterval() not working in Mozilla 1.7.1


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