JavaScript Reference/Javascript Methods/scrollTo — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
"scrollTo()" Example
<html>
<body>
<script language="JavaScript">
function function1(){
window.scrollTo(200,200);
}
function function2(){
window.scroll(200,200);
}
</script>
<input type="button" value="Scroll to (200,200)" onClick="function1();">
<input type="button" value="Scroll(200,200)" onClick="function2();">
<div style="height:1000;width:1500;background-color:blue;"></div>
</body>
</html>
"scrollTo()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |window |
+----------------+--------------------------------------------------------------+
"scrollTo()" Syntax, Parameters and Note
Note:
Scrolls window to the specified values. (a new version of the scroll() method)
Syntax:
window.scrollTo(param1, param2)
Parameters:
param1 Required; the horizontal scroll amount in pixels.
param2 Required; the vertical scroll amount in pixels.