|
-
June 21st, 2007, 09:54 PM
#1
SetInterval called function crashes
I have an web app with some javascript functions. When you click a button it starts two "SetInterval" timers going, each calling a separate function. It calls one function first, and then it crashes. I get this error while debugging the page with VB.Net:
"Microsoft Javascript Error. Object Expected [Break][Continue]"
When I click "Continue" another error pops up:
"There is no source code available for the current location. [OK]"
When I step through the code, it crashes after exiting one of the timer functions. It's as if it has no place to go when it returns to caller.
Here's the script code stripped down to the bare ninimum (still crashes!)
Code:
// JScript File
var tmr1, tmr2
function HitScreen()
{
var a=0
} // crashers when it exits here.
function reCallServer()
{
var b=0
}
function btnStart_click() // This executes when I click the "Start" button
{
if (tmr1 == null)
{
var delay = parseInt(document.getElementById("txtRate").value)
tmr1 = setInterval("HitScreen()", delay)
}
if (tmr2 == null)
{
tmr2 = setInterval("ReCallServer()", 100)
}
return false
}
function btnStop_click()
{
if (tmr2 != null)
{
clearInterval(tmr2)
tmr2 = null
}
return false
}
The web page is actually an ASP.Net page with AJAX controls: A Script manager, and some slider controls, along with some buttons, text boxes, div boxes, etc. I don't know if any of that is a factor. The same errors occur when I debug with firefox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|