日期:2014-05-16  浏览次数:20366 次

如何利用js函数使html页面从底部返回到顶端
我有一个按钮,
<input   name= "Submit "   type= "submit "   class= "button "   onclick= "goto( 'http://www.google.fr/search ', 'q ', '1500 ') "value= "Google "     />

我想在按下按钮的时候页面自动返回到顶端,因为这个按钮在页面最下方。
现在这个按钮在一个form中,并且已经调用一个js   函数,我想能不能在现有函数加点代码,实现 <a   herf= "#top "> </top> 的功能。

现在函数如下:
function   goto(act,ser,hhh){  
document.getElementById( 'top ').action=act;
document.getElementById( 'q ').name=ser;  
document.getElementById( 'serch ').height=hhh;
document.getElementById( 'contain ').style.display= "none ";
document.getElementById( 'q2 ').value=document.getElementById( 'q ').value;
}

------解决方案--------------------
document.body.scrollTop=0;
------解决方案--------------------
b.select();