Ugh. Two days of scripting and searching, and I can't find this answer anywhere. Please help!
Whenever I try to use setTimeout with anything object-related, I usually end up trying set my computer ablaze.
For instance, I have two <div> objects...I most likely will have to build more down the road. Internal website, so I only have to code for IE5 (and was told to only code for this). Each layer div object has a button that should be able to slide down a specified distance, and when the button is clicked again, up it goes. I prefer to use the slide animation if at all possible, but I've been having multiple problems. Here is the latest:
//I would fire this off by -> onclick = "passFunc('dragWin');return false;"
function getobje(divName){
this.divObj = document.all[divName]
this.css = document.all[divName].style
this.divTop = document.all[divName].style.top
this.divLeft = document.all[divName].style.left
this.state = true
this.slideWin = slideWinUp;
}
function passFunc(objStr){
theObj = new getobje(objStr):0
theObj.slideWin()
}
function slideWinUp(){
if(this.state){
if(parseInt(theObj.divTop)!=0){
theObj.divTop = parseInt(theObj.divTop)+14
setTimeout(theObj +'.slideWin()',20)
}
else{
clearTimeout();
this.state = false
return 0;
}
}
else {
if(parseInt(theObj.divTop)!= -280){
theObj.divTop = parseInt(theObj.divTop)-14
setTimeout('slideWinUp()',20)
}
else{
clearTimeout();
this.state = true
return 0;
}
}
}
After I put some alert statements in there, I found that the properties were in fact changing, but no animation. I've tried to simply pass an object as an argument to the slideWinUp() function, but it only knows about the object once.
PLEASE, please help.
--Jae.
Whenever I try to use setTimeout with anything object-related, I usually end up trying set my computer ablaze.
For instance, I have two <div> objects...I most likely will have to build more down the road. Internal website, so I only have to code for IE5 (and was told to only code for this). Each layer div object has a button that should be able to slide down a specified distance, and when the button is clicked again, up it goes. I prefer to use the slide animation if at all possible, but I've been having multiple problems. Here is the latest:
//I would fire this off by -> onclick = "passFunc('dragWin');return false;"
function getobje(divName){
this.divObj = document.all[divName]
this.css = document.all[divName].style
this.divTop = document.all[divName].style.top
this.divLeft = document.all[divName].style.left
this.state = true
this.slideWin = slideWinUp;
}
function passFunc(objStr){
theObj = new getobje(objStr):0
theObj.slideWin()
}
function slideWinUp(){
if(this.state){
if(parseInt(theObj.divTop)!=0){
theObj.divTop = parseInt(theObj.divTop)+14
setTimeout(theObj +'.slideWin()',20)
}
else{
clearTimeout();
this.state = false
return 0;
}
}
else {
if(parseInt(theObj.divTop)!= -280){
theObj.divTop = parseInt(theObj.divTop)-14
setTimeout('slideWinUp()',20)
}
else{
clearTimeout();
this.state = true
return 0;
}
}
}
After I put some alert statements in there, I found that the properties were in fact changing, but no animation. I've tried to simply pass an object as an argument to the slideWinUp() function, but it only knows about the object once.
PLEASE, please help.
--Jae.
Comment