jmc92 Posted February 3, 2010 Share Posted February 3, 2010 I found this code on a web page but I cant seem to get it to work also I would like it so it starts scrolling up on mousedown and stops on mouseoutHow do I fix this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><script type="text/javascript">var goto_top_type = -1;var goto_top_itv = 0;function goto_top_timer() {var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;//alert(y);var moveby = 50; // set this to control scroll seed. minimum is fasty -= Math.ceil(y * moveby / 100);if (y < 0)y = 0;if (goto_top_type == 1)document.documentElement.scrollTop = y;elsedocument.body.scrollTop = y;if (y == 0) {clearInterval(goto_top_itv);goto_top_itv = 0;}}function goto_top() {if (goto_top_itv == 0) {if (document.documentElement && document.documentElement.scrollTop)goto_top_type = 1;else if (document.body && document.body.scrollTop)goto_top_type = 2;elsegoto_top_type = 0;if (goto_top_type > 0)goto_top_itv = setInterval('goto_top_timer()', 50);}}</script><script type="text/javascript">if (event.keyCode == 13){event.returnValue=false;event.cancelBubble = true;frames['iframe1'].location.href=document.form1.url.value;} </script><script type="text/javascript">function displayunicode(e){var unicode=e.keyCode? e.keyCode : e.charCodeif(unicode==13){ frames['iframe1'].location.href=document.getElementById("url").value }}</script></head><input type="image" src="goto_top.gif" onclick="frames['iframe1'].location."goto_top();"><iframe id="iframe1" src="http://www.google.com" border="0" style="border: 0px; width:476px; height: 197px; position:absolute; top:63px; left:2px;" name="iframe1"></iframe></body></html> Link to comment Share on other sites More sharing options...
jmc92 Posted February 4, 2010 Author Share Posted February 4, 2010 Sorry for the double post.But it's been 48 hrs with no response. Link to comment Share on other sites More sharing options...
Ingolme Posted February 4, 2010 Share Posted February 4, 2010 In order to scroll an iframe you have to access the document within it. You're only allowed to access the document if it's on the same domain as your own page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.