Forum Moderators: open
Im running aspx pages through IIS 6
using IE for testing
Ive got a problem that I wanted to use javascript to solve. But I hit a snag with setInterval. I cant get the darn thing to work the way its supposed to. Here is a sample:
<code>
<html>
<head>
<script language="JavaScript" type='text/javascript'>
t=setInterval('clock()',100);
function clock()
{
document.write( "¦" );
}
</script>
</head>
<body>
</body>
</html>
</code>
This will print ¦ one time. I was under the impression that setInterval will automatically continue to call the function I specified every 100 miliseconds...
if so, what is interfering with this?
Try using a form element to display the visual:
<form id="timer">
<input type="text" id="display" size=100 style="border-width:0px;font-weight:bold">
</form>
<script type="text/javascript">
t=setInterval("clock()",100);
var ticks = "¦";
var tickDisplay = document.getElementById("display");
function clock() {
tickDisplay.value += ticks;
}
</script>
<edit>Welcome to the forums, Matt!</edit>
<form id="timer">
<input type="text" id="display" size=100 style="border-width:0px;font-weight:bold">
</form>
<script type="text/javascript">
var ticks = "¦";
var tickDisplay = document.getElementById("display");
function clock() {
tickDisplay.value += ticks;
}
t=setInterval("clock()",100);
</script> Sorry ... :)