首页 > 编程语言 > 详细

JavaScript code to let users double-click to move back to the top of the page

时间:2015-06-18 21:32:08      阅读:290      评论:0      收藏:0      [点我收藏+]

 

Here‘s some JavaScript code I found today while poking around the net. Embed this JavaScript code in a web page, and a user can simply double-click anywhere on the page to automatically move back to the beginning of the page. Pretty cool idea. Here‘s the code:

<script language="JavaScript1.2" 
           type="text/javascript">
<!--
function dblclick() 
{ 
  window.scrollTo(0,0) 
}
if (document.layers) 
{ 
  document.captureEvents(ONDBLCLICK); 
}
document.ondblclick=dblclick; 
-->
</script>

  

JavaScript code to let users double-click to move back to the top of the page

原文:http://www.cnblogs.com/hephec/p/4586819.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!