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

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>

  

时间: 2024-10-09 15:02:11

JavaScript code to let users double-click to move back to the top of the page的相关文章

javaScript Code 用javascript确定每月第二个星期五

废话少说只就上Code: 说明:getDay()方法获取星期(这里的星期是从0到6).参见:http://www.w3school.com.cn/js/js_obj_date.asp 中的getDay(). 代码有不足之处希望得到指正. var SecondFriday = { getSecondFriday: function () { var flag = 0; //(1) 获取当月月初时间,时间格式为:Sun Jun 01 2014 00:00:00 GMT+0800 (中国标准时间) v

[Python學習筆記] 使用 selenium 抓取網頁並且雙擊滑鼠 (double click)

一開始使用的時候 看官方文件 以為使用 double_click()即可 但後來出現錯誤 AttributeError: 'WebElement' object has no attribute 'double_click' 後來找了一下解決方式如下 需要再多import ActionChains from selenium import webdriver from selenium.webdriver import ActionChains driver = webdriver.Chrome

老生常谈:ie6下,a标签href设置javascript:void(0);后绑定的click失效

老生常谈:ie6下,a标签href设置javascript:void(0);后绑定的click事件,如果有form表单提交或跳转等事件,会失效!举例: <a id="id_back" href="javascript:void(0);" title="返回管理">返 回</a> $("#id_back").click(function(){         $("#id_frm").

JavaScript code modules

https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules Non-standardThis feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be la

Random Javascript code snippets

MollyPages.org"You were wrong case.To live here is to live." Home Pages / Database / Forms / Servlet / Javadocs / License & Download / Tutorials / Cookbook / Contact Return to Tutorials index Random collection of misc. code and snippets Priv

[javascript]Three parts of javascript code snippet

<script> (function(){ /* if (navigator.userAgent.toLowerCase().indexOf("iphone") == -1){ $("#id_download_btn img").attr("src" , "http://cache.hinabian.com/mobile/images/downLoadLink.png"); return; } */ var old

Server Side JavaScript Code Injection Attack服务端js注入攻击

今天扫描器误报了这个漏洞,我觉着是误报了. 趁机了解一下, 好像是针对nosql与nodejs的服务端, 我觉着可能是js对于nodejs就是可执行的代码, 也就是任意代码执行, 这么一个攻击. stackoverflow上有一个http://stackoverflow.com/questions/27879131/server-side-javascript-code-injection-attack 巧了,看来我和他用了同款扫描工具,有了同样的问题. 看回答,大意竟是赞同他aspx可能有这个

win10家庭版,双击bat文件无法运行(double click bat file does not execute)

win10家庭版,双击bat文件无法运行,弹出文件打开方式选择框. 在网上搜索处理办法,试了以下方法1-5都没有成功,用方法6规避. 方法1:打开一个驱动器,点"工具-文件夹选项→文件类型→新建→扩展名"里输入BAT,点高级,在关联的类型里选择"MS-DOS批处理文件",再确定 --因为我用的是win10家庭版,没找到对应位置. 方法2:用管理员打开命令行,在命令行中分别输入下面两条命令:assoc .bat=batfileftype batfile="%

Javascript周报#182

This week’s JavaScript news Read this issue on the Web | Issue Archive JavaScript Weekly Issue 182May 23, 2014 Editor: Peter Cooper   Featured Data-Binding Revolutions with Object.observe() — Object.observe(), part of a future ECMAScript standard, is