By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

Firefox problem

Fuhrer
P: 30
Hi all,
i'm testing a javascript code that allow me to see a timer(just minutes and seconds) when a start button is clicked:
[HTML]<html>
<head>
<title>Test</title>
<script language="javascript">
var TimerID;
var min,sec;
function Start(min,sec)
{
if(sec<59)
sec+=1;
else
{
sec=0;
min+=1;
}
document.form1.Timer.value=min+":"+sec;
TimerID=setTimeout("Start("+min+","+sec+")",1000);
}
</script>
</head>
<body>
<form name="form1">
<input type="text" id="Timer">
<input type="button" value="start" onClick="Start(0,0)">
</form>
</body>
</html>[/HTML]

my problem is when i'm trying to run this script in firefox or other browsers than IE, it wont work.
So what should i do to make it work in mozilla?

Thanks
Nov 21 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 210

So what should i do to make it work in mozilla?
Enable JavaScript in Mozilla.
Nov 22 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Your input tag has an id "Timer", but you're trying to access it by its name. IE may allow you to do this (which doesn't make it clever because it's wrong).

Use document.getElementById("Timer") instead.

PS. please use code tags when posting code.
Nov 22 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.