d22552000 Posted December 25, 2007 Share Posted December 25, 2007 statica.style.top=currentpos+"px" statica.style.left=5+"px" When I put that in my script, it f***s up and says it expects an object at the "s" in "statica.style.top".. .. My full script is here: <script type="text/javascript" language="JavaScript1.2"> var speed=50 var currentpos=0 var statica=document.getElementById("asvesee"); function scrollwindow(){ if (document.all) currentpos=document.body.scrollTop+speed else currentpos=window.pageYOffset+speed window.scroll(0,currentpos) // I am trying to put statica movement HERE. } function startit(){ setInterval("scrollwindow()",50) } </script> <div id="asvesee" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 425px;"> <a href="javascript:startit()">Auto-Scroll Progress</a><br /> Remember, you can close this page, and the upload will continue!<br /> Please email [email protected] with bugs and feedback. </div> This is a VERY simple script to auto-scroll the window, and doesn't quite work on all browsers, but I suck at javascript (as you can tell by my simple question) Please tell me why it won't work, and how to fix it. BTW: This error comes up in IE7. Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/ Share on other sites More sharing options...
phpQuestioner Posted December 26, 2007 Share Posted December 26, 2007 try this: <script language="javascript"> var speed=50 var currentpos=0 var statica=document.getElementById("asvesee"); function scrollwindow(){ if (document.all) { currentpos = document.body.scrollTop + speed; } else { currentpos = window.pageYOffset + speed; } window.scroll(0,currentpos); // I am trying to put statica movement HERE. statica.style.top = currentpos +"px"; statica.style.left="5px"; } function startit(){ setInterval("scrollwindow()",50) } </script> <div id="asvesee" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 425px;"> <a href="javascript:startit()">Auto-Scroll Progress</a><br /> Remember, you can close this page, and the upload will continue!<br /> Please email [email protected] with bugs and feedback. </div> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> Note: I did not test the above code in IE7; but it works fine in FF and IE6. Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/#findComment-423103 Share on other sites More sharing options...
d22552000 Posted December 28, 2007 Author Share Posted December 28, 2007 but it says object required in IE7. AAAAARRRRRRRRRRRRRRRGGGGGGGGGGGGGHHHHHHHHHH I hate IE7, but my site needs to be crowse browser compatible Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/#findComment-424925 Share on other sites More sharing options...
phpQuestioner Posted December 28, 2007 Share Posted December 28, 2007 try this: <script language="javascript"> var speed=50 var currentpos=0 var statica=document.getElementById("asvesee"); function scrollwindow(){ if (document.all) { currentpos = document.body.scrollTop + speed; } else { currentpos = window.pageYOffset + speed; } window.scroll(0,currentpos); // I am trying to put statica movement HERE. document.getElementById("asvesee").style.top = currentpos +"px"; document.getElementById("asvesee").style.left="5px"; } function startit(){ setInterval("scrollwindow()",50) } </script> <div id="asvesee" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 425px;"> <a href="javascript:startit()">Auto-Scroll Progress</a><br /> Remember, you can close this page, and the upload will continue!<br /> Please email [email protected] with bugs and feedback. </div> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/#findComment-424937 Share on other sites More sharing options...
d22552000 Posted December 30, 2007 Author Share Posted December 30, 2007 Thankyou, it worked, but it was too jerky. So I had to resort to putting the dv in a frame at the top of the page >< Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/#findComment-425727 Share on other sites More sharing options...
phpQuestioner Posted December 30, 2007 Share Posted December 30, 2007 sounds good to me Link to comment https://forums.phpfreaks.com/topic/83174-solved-very-simple-moving-a-absolutely-positioned-div/#findComment-425735 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.