Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] How to set the scrolling of a div


  • From: bernu at lptmc.jussieu.fr (Bernu Bernard)
  • Subject: [Javascript] How to set the scrolling of a div
  • Date: Fri Jan 12 09:54:49 2007

Hi list,

I have a container div with heigth:100px and overflow:auto
Inside I have a div with a height:200px. Thus the container div has a  
vertical scrollbar.

I tried without success scrollBy and scrollTo : div does not  
understand these functions

What should I do so that the inner-div scroll by 50px.

Bernard
This is a simple example :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns = "http://www.w3.org/1999/xhtml";  >
	<head>
		<title>test scroll bar</title>
<script type="text/javascript"><!--

function scrolldiv( ) {
	var x = document.getElementById( "div1" )
	x.scrollBy( 10, 10 ) ;
	alert("ok");
}

--></script>
	</head>
	<body onload="scrolldiv( ) ">
		<div id="div1" style="height:100px; border:solid 10px #00f ;  
overflow:auto">
			<div id="div2" style="height:200px; background: #fee; border:solid  
10px #0f0"></div>
		</div>
	</body>
</html>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.LaTech.edu/pipermail/javascript/attachments/20070112/940b7170/attachment.html