Welcome to WebmasterWorld Guest from 54.226.60.235

Forum Moderators: incrediBILL

Message Too Old, No Replies

Iframe Scrolling

iframe scrolling outpage

     

atrjeu_ne

5:08 am on Jul 25, 2010 (gmt 0)

5+ Year Member



I've trying looking for a script that allow me scroll an iframe fromanother page, i finally found it, and works well in FF and IE:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>

<meta HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
* {
margin:0;
padding:0;
}
body {
margin:40px;
}
select {
width:130px;
}
#container {
width:1000px;
height:600px;
border:3px double #999;
margin:auto;
}
#myiframe {
width:100%;
height:100%;
}
</style>

<script type="text/javascript">
window.onload=function() {
document.forms[0][0].onchange=function() {
divscroll(this.value);
}
}
function divscroll(num) {
if(num!='') {
document.getElementById('myiframe').contentWindow.scrollTo(0,num);
}
}
</script>

</head>
<body>

<form action="#">
<div>
<select>
<option value=""> scroll to options </option>
<option value="0">0</option>
<option value="215" default>215</option>
<option value="365">365</option>
<option value="515">515</option>
<option value="750">750</option>
</select>
</div>
</form>

<div id="container">
<iframe src="lorem.php" id="myiframe" frameborder="0" scrolling="no" ></iframe>
<!--<IFRAME src= 'lorem.html' id="myiframe scrolling="no" WIDTH="1010" HEIGHT="500">-->
</div>
</body>
</html>

You must to create another page "lorem.html" and insert this:

<IFRAME src= 'http://www.thepageThatYouWantToInsert.com' WIDTH="1010" HEIGHT="700"><BR></IFRAME>

¡Saludos desde México!

tedster

2:15 am on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks for sharing this - it can come in handy at times.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month