[Javascript] setTimout problems (again)
Peter Brunone
peter at brunone.com
Thu Jul 11 10:22:04 CDT 2002
Chris,
I would suggest not using the same name for two variables, even if one is
global and one local.
Just an extra 2 cents...
Peter
|-----Original Message-----
|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
|Behalf Of Chris Basken
|Sent: Thursday, July 11, 2002 10:04 AM
|To: JSList
|Subject: [Javascript] setTimout problems (again)
|
|
|Why is setTimout such a pain to use? I have a function that I want to call
|itself every so often:
|
|function
|putLayer(layerName,timeOutPause,Xinc,Yinc,toX,toY,moveSteps,currentStep) {
| document.all[layerName].style.left =
|Math.round(parseInt(document.all[layerName].style.left) + Xinc);
| document.all[layerName].style.top =
|Math.round(parseInt(document.all[layerName].style.top) + Yinc);
| currentStep++;
|
| if (currentStep <= moveSteps) {
|
|setTimeout("putLayer(layerName,timeOutPause,Xinc,Yinc,toX,toY,moveS
|teps,curr
|entStep)",timeOutPause);
| }
|
|}
|
|This function works once (it's called from elsewhere; a setup function that
|defines those arguments initially), then warns me that "layerName is not
|defined". I've tried it with the function call in quotes, not quoted,
|quoted but with the arguments not in quotes ("putLayer(" +
|layerName + "," +
|timeoutPause... etc), and with the arguments following the pause argument
|(which is what Netscape's DevEdge page says to do). Nothing
|works. Is this
|function just defunct or something? Or am I blind as a bat and
|there's some
|silly error in my function causing it to frank out?
|
|Agh!
|
|
|_______________________________________________
|Javascript mailing list
|Javascript at LaTech.edu
|https://lists.LaTech.edu/mailman/listinfo/javascript
|
More information about the Javascript
mailing list