javascript大全
事件源对象
event.srcElement.tagName
event.srcElement.type
捕获释放
event.srcElement.setCapture();
event.srcElement.releaseCapture();
事件按键
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
事件返回值
event.returnValue
鼠标位置
event.x
event.y
窗体活动元素
document.activeElement
绑定事件
document.captureEvents(Event.KEYDOWN);
访问窗体元素
document.all("txt").focus();
document.all("txt").select();
窗体命令
document.execCommand
窗体COOKIE
document.cookie
菜单事件
document.oncontextmenu
创建元素
document_createElement_x_x("SPAN");
根据鼠标获得元素:
document.elementFromPoint(event.x,event.y).tagName=="TD
document.elementFromPoint(event.x,event.y).a(ms)
窗体图片
document.images[索引]
窗体事件绑定
document.onmousedown=scrollwindow;
元素
document.窗体.elements[索引]
对象绑定事件
document.all.xxx.detachEvent('onclick',a);
插件数目
navigator.plugins
取变量类型
typeof($js_libpath)=="undefined"
下拉框
下拉框.options[索引]
下拉框.options.length
查找对象
document.getElementsByName("r1");
document.getElementByIdx_x_x(id);
定时
timer=setInterval('scrollwindow()',delay);
clearInterval(timer);
UNCODE编码
escape(),
父对象
obj.parentElement(dhtml)
obj.parentNode(dom)
交换表的行
TableID.moveRow(2,1)
替换CSS
document.all.csss.href="a.css";
并排显示
display:inline
隐藏焦点
hidefocus=true
根据宽度换行
style="word-break:break-all"
自动刷新
<metaHTTP-EQUIV="refresh"CONTENT="8;URL=http://c98.yeah.net">
简单邮件
<ahref="mailto:aaa@bbb.com?subject=ccc&body=xxxyyy">
快速转到位置
obj.scrollIntoView(true)
锚
<aname="first">
<ahref="#first">anchors</a>
网页传递参数
location.search();
可编辑
obj.contenteditable=true
执行菜单命令
obj.execCommand
双字节字符
/[^/x00-/xff]/
汉字
/[/u4e00-/u9fa5]/
让英文字符串超出表格宽度自动换行
word-wrap:break-word;word-break:break-all;
透明背景
<IFRAMEsrc="1.htm"width=300height=180allowtransparency></iframe>
获得style内容
obj.style.cssText
HTML标签
document.documentElement.innerHTML
第一个style标签
document.styleSheets[0]
style标签里的第一个样式
document.styleSheets[0].rules[0]
防止点击空链接时,页面往往重置到页首端。
<ahref="javascript:function()">word</a>
上一网页源
asp:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer
释放内存
CollectGarbage();
禁止右键
document.oncontextmenu=function(){returnfalse;}
禁止保存
<noscript><iframesrc="*.htm"></iframe></noscript>
禁止选
取<bodyoncontextmenu="returnfalse"ondragstart="returnfalse"onselectstart="returnfalse"onselect="document.selection.empty()"oncopy="document.selection.empty()"onbeforecopy="returnfalse"onmouseup="document.selection.empty()>
禁止粘贴
<inputtype=textonpaste="returnfalse">
地址栏图标
<linkrel="ShortcutIcon"href="favicon.ico">
favicon.ico名字最好不变16*16的16色,放虚拟目录根目录下
收藏栏图标
<linkrel="Bookmark"href="favicon.ico">
查看源码
<inputtype=buttonvalue=查看网页源代码onclick="window.location='view-source:'+'http://www.csdn.net/'">
关闭输入法
<inputstyle="ime-mode:disabled">
自动全选
<inputtype=textname=text1value="123"onfocus="this.select()">
ENTER键可以让光标移到下一个输入框
<inputonkeydown="if(event.keyCode==13)event.keyCode=9">
文本框的默认值
<inputtype=textvalue="123"onfocus="alert(this.defaultValue)">
title换行
obj.title="123 sdfs "
获得时间所代表的微秒
varn1=newDate("2004-10-10".replace(/-/g,"//")).getTime()
窗口是否关闭
win.closed
checkbox扁平
<inputtype=checkboxstyle="position:absolute;clip:rect(5px15px15px5px)"><br>
获取选中内容
document.selection.createRange().duplicate().text
自动完成功能
<inputtype=textautocomplete=on>打开该功能
<inputtype=textautocomplete=off>关闭该功能
窗口最大化
<bodyonload="window.resizeTo(window.screen.width-4,window.screen.height-50);window.moveTo(-4,-4)">
无关闭按钮IE
window.open("aa.htm","meizz","fullscreen=7");
统一编码/解码
alert(decodeURIComponent(encodeURIComponent("http://你好.com?as=hehe")))
encodeURIComponent对":"、"/"、";"和"?"也编码
表格行指示
<tronmouseover="this.bgColor='#f0f0f0'"onmouseout="this.bgColor='#ffffff'">
javascript大全的更多相关文章
- 我要成为前端工程师!给 JavaScript 新手的建议与学习资源整理
来源于:http://blog.miniasp.com/post/2016/02/02/JavaScript-novice-advice-and-learning-resources.aspx 今年有 ...
- Python入门笔记(13):列表解析
一.列表解析 列表解析来自函数式编程语言(haskell),语法如下: [expr for iter_var in iterable] [expr for iter_var in iterable i ...
- [jQuery] 自做 jQuery Plugin - Part 1
有時候寫 jQuery 時,常會發現一些簡單的效果可以重複利用.只是每次用 Copy & Paste 大法似乎不是件好事,有沒有什麼方法可以讓我們把這些效果用到其他地方呢? 沒錯,就是用 jQ ...
- 《转》python学习(12)-列表解析
转自 http://www.cnblogs.com/BeginMan/p/3164937.html 一.列表解析 列表解析来自函数式编程语言(haskell),语法如下: [expr for iter ...
- 《转》python 12 列表解析
转自 http://www.cnblogs.com/BeginMan/p/3164937.html 一.列表解析 列表解析来自函数式编程语言(haskell),语法如下: [expr for iter ...
- python 集合(set)和字典(dictionary)的用法解析
Table of Contents generated with DocToc ditctaionary and set hash 介绍 集合-set 创建 操作和访问集合的元素 子集.超集.相对判断 ...
- 【JS】javascript 正则表达式 大全 总结
javascript 正则表达式 大全 总结 参考整理了一些javascript正则表达式 目的一:自我复习归纳总结 目的二:共享方便大家搜索 微信:wixf150 验证数字:^[0-9]*$ 验证n ...
- JavaScript资源大全中文版(Awesome最新版--转载自张果老师博客)
JavaScript资源大全中文版(Awesome最新版) 目录 前端MVC 框架和库 包管理器 加载器 打包工具 测试框架 框架 断言 覆盖率 运行器 QA 工具 基于 Node 的 CMS 框 ...
- JavaScript验证正则表达式大全
JavaScript验证正则表达式大全,搜集最全的JavaScript验证正则表达式,开始查看吧,这里的都是正则表达式的例子,具体和函数结合的使用方法,还请查看下篇文章<JavaScript使用 ...
随机推荐
- swiper组件实现向上翻页时缩小
var mySwiper = new Swiper ('.swiper-container', { direction: 'vertical', loop: true, // 如果需要前进后退按钮 n ...
- sina第三方登录
Sina 第三方登录 添加网站的流程如下: Sina接入主要审核点: • 1.网站可正常访问:若页面无法打开,或加载时间过长,或未建设完成的网站.或空白网站将无法通过审核: • 2.站点已部署微连接 ...
- operator new3种情况详解
[本文链接] http://www.cnblogs.com/hellogiser/p/operator-new.html [代码] C++ Code 12345678910111213141516 ...
- 玩转ubuntu FAQ
一.用wubi安装ubuntu的时候自动重新下载 1.双击ubuntu.ios让windows加载这个镜像 2.断开网络 二.安装其他程序时提示Error: Dependency is not sat ...
- 在cmd命令行中弹出Windows对话框
有时候用bat写一些小脚本最后会弹出对话框提示操作成功,可以用mshta.exe来实现,它是Windows系统的相关程序,用来执行.HTA文件,一般计算机上面都有这个程序,实现如下: mshta vb ...
- GPU CUDA 经典入门指南
转自:http://luofl1992.is-programmer.com/posts/38830.html CUDA编程中,习惯称CPU为Host,GPU为Device.编程中最开始接触的东西恐怕是 ...
- Jil序列化JSON
使用Jil序列化JSON提升Asp.net web api 性能 JSON序列化无疑是Asp.net web api 里面性能提升最重要的一环. 在Asp.net web api 里面我们可以插入 ...
- 13、在 uwp应用中,给图片添加高斯模糊滤镜效果(一)
如果在应用中,如果想要给app 添加模糊滤镜,可能第一想到的是第三方类库,比如 Win2d.lumia Imaging SDK .WriteableBitmapEx,不可否认,这些类库功能强大,效果也 ...
- hdu 1542 扫描线求矩形面积的并
很久没做线段树了 求矩形面积的并分析:1.矩形比较多,坐标也很大,所以横坐标需要离散化(纵坐标不需要),熟悉离散化后这个步骤不难,所以这里不详细讲解了,不明白的还请百度2.重点:扫描线法:假想有一条扫 ...
- 【软件工程】week5-个人作业-敏捷开发方法初窥
敏捷开发方法初窥 引言:本周的软件工程个人博客作业是阅读关于敏捷开发方法的文章(http://martinfowler.com/agile.html),并撰写自己的读后感.文章内容非常丰富,对敏捷开发 ...