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("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" - 自动刷新
<meta HTTP-EQUIV="refresh" CONTENT="8;URL=http://c98.yeah.net"> - 简单邮件
<a href="mailto:aaa@bbb.com?subject=ccc&body=xxxyyy"> - 快速转到位置
obj.scrollIntoView(true) - 锚
<a name="first">
<a href="#first">anchors</a> - 网页传递参数
location.search(); - 可编辑
obj.contenteditable=true - 执行菜单命令
obj.execCommand - 双字节字符
/[^\x00-\xff]/
汉字
/[\u4e00-\u9fa5]/ - 让英文字符串超出表格宽度自动换行
word-wrap: break-word; word-break: break-all; - 透明背景
<IFRAME src=http://dotnet.csdn.net/"1.htm" width=300 height=180 allowtransparency></iframe> - 获得style内容
obj.style.cssText - HTML标签
document.documentElement.innerHTML - 第一个style标签
document.styleSheets[0] - style标签里的第一个样式
document.styleSheets[0].rules[0] - 防止点击空链接时,页面往往重置到页首端。
<a href="javascript:function()">word</a> - 上一网页源
asp:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer - 释放内存
CollectGarbage(); - 禁止右键
document.oncontextmenu = function() { return false;} - 禁止保存
<noscript><iframe src=http://dotnet.csdn.net/"*.htm"></iframe></noscript> - 禁止选取<body oncontextmenu=http://dotnet.csdn.net/"return false" ondragstart=http://dotnet.csdn.net/"return false" onselectstart =http://dotnet.csdn.net/"return false" onselect=http://dotnet.csdn.net/"document.selection.empty()" oncopy=http://dotnet.csdn.net/"document.selection.empty()" onbeforecopy=http://dotnet.csdn.net/"return false"onmouseup=http://dotnet.csdn.net/"document.selection.empty()>http://dotnet.csdn.net/
- 禁止粘贴
<input type=text onpaste="return false"> - 地址栏图标
<link rel="Shortcut Icon" href="favicon.ico">
favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下 - 收藏栏图标
<link rel="Bookmark" href="favicon.ico"> - 查看源码
<input type=button value=查看网页源代码 onclick="window.location = 'view-source:'+ 'http://www.csdn.net/'"> - 关闭输入法
<input style="ime-mode:disabled"> - 自动全选
<input type=text name=text1 value="123" onfocus="this.select()"> - ENTER键可以让光标移到下一个输入框
<input onkeydown="if(event.keyCode==13)event.keyCode=9"> - 文本框的默认值
<input type=text value="123" onfocus="alert(this.defaultValue)"> - title换行
obj.title = "123 sdfs " - 获得时间所代表的微秒
var n1 = new Date("2004-10-10".replace(/-/g, "\/")).getTime() - 窗口是否关闭
win.closed - checkbox扁平
<input type=checkbox style="position: absolute; clip:rect(5px 15px 15px 5px)"><br> - 获取选中内容
document.selection.createRange().duplicate().text - 自动完成功能
<input type=text autocomplete=on>打开该功能
<input type=text autocomplete=off>关闭该功能 - 窗口最大化
<body onload="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对":"、"/"、";" 和 "?"也编码 - 表格行指示
<tr onmouseover="this.bgColor='#f0f0f0'" onmouseout="this.bgColor='#ffffff'">
//各种尺寸s += http://dotnet.csdn.net/"\r\n网页可见区域宽:"+ document.body.clientWidth;
s += http://dotnet.csdn.net/"\r\n网页可见区域高:"+ document.body.clientHeight;
s += http://dotnet.csdn.net/"\r\n网页可见区域高:"+ document.body.offsetWeight +http://dotnet.csdn.net/" (包括边线的宽)";
s += http://dotnet.csdn.net/"\r\n网页可见区域高:"+ document.body.offsetHeight +http://dotnet.csdn.net/" (包括边线的宽)";
s += http://dotnet.csdn.net/"\r\n网页正文全文宽:"+ document.body.scrollWidth;
s += http://dotnet.csdn.net/"\r\n网页正文全文高:"+ document.body.scrollHeight;
s += http://dotnet.csdn.net/"\r\n网页被卷去的高:"+ document.body.scrollTop;
s += http://dotnet.csdn.net/"\r\n网页被卷去的左:"+ document.body.scrollLeft;
s += http://dotnet.csdn.net/"\r\n网页正文部分上:"+ window.screenTop;
s += http://dotnet.csdn.net/"\r\n网页正文部分左:"+ window.screenLeft;
s += http://dotnet.csdn.net/"\r\n屏幕分辨率的高:"+ window.screen.height;
s += http://dotnet.csdn.net/"\r\n屏幕分辨率的宽:"+ window.screen.width;
s += http://dotnet.csdn.net/"\r\n屏幕可用工作区高度:"+ window.screen.availHeight;
s += http://dotnet.csdn.net/"\r\n屏幕可用工作区宽度:"+ window.screen.availWidth;
//过滤数字
//特殊用途
//不缓存
//正则匹配
匹配双字节字符(包括汉字在内):[^\x00-\xff]
匹配空行的正则表达式:\n[\s| ]*\r
匹配HTML标记的正则表达式:/<(.*)>.*<\/\1>|<(.*) \/>/
匹配首尾空格的正则表达式:(^\s*)|(\s*$)(像vbscript那样的trim函数)
匹配Email地址的正则表达式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
匹配网址URL的正则表达式:http:http://dotnet.csdn.net///([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
以下是例子:
利用正则表达式限制网页表单里的文本框输入内容:
用正则表达式限制只能输入中文:onkeyup=http://dotnet.csdn.net/"value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste=http://dotnet.csdn.net/"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"
1.用正则表达式限制只能输入全角字符: onkeyup=http://dotnet.csdn.net/"value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste=http://dotnet.csdn.net/"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))"
2.用正则表达式限制只能输入数字:onkeyup=http://dotnet.csdn.net/"value=value.replace(/[^\d]/g,'') "onbeforepaste=http://dotnet.csdn.net/"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
3.用正则表达式限制只能输入数字和英文:onkeyup=http://dotnet.csdn.net/"value=value.replace(/[\W]/g,'') "onbeforepaste=http://dotnet.csdn.net/"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
//消除图像工具栏
or
<head>
<meta http-equiv=http://dotnet.csdn.net/"imagetoolbar" content=http://dotnet.csdn.net/"no">
</head>
//无提示关闭
{
http://dotnet.csdn.net/var ua=navigator.userAgent
http://dotnet.csdn.net/var ie=navigator.appName==http://dotnet.csdn.net/"Microsoft Internet Explorer"?http://dotnet.csdn.net/true:false
http://dotnet.csdn.net/if(ie)
{
http://dotnet.csdn.net/var IEversion=parseFloat(ua.substring(ua.indexOf(http://dotnet.csdn.net/"MSIE ")+5,ua.indexOf(http://dotnet.csdn.net/";",ua.indexOf(http://dotnet.csdn.net/"MSIE "))))
http://dotnet.csdn.net/if(IEversion< 5.5)
{
http://dotnet.csdn.net/var str = '<object id=noTipClose classid=http://dotnet.csdn.net/"clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
str += '<param name=http://dotnet.csdn.net/"Command" value=http://dotnet.csdn.net/"Close"></object>';
document.body.insertAdjacentHTML(http://dotnet.csdn.net/"beforeEnd", str);
document.all.noTipClose.Click();
}
else
{
window.opener =http://dotnet.csdn.net/null;
window.close();
}
}
else
{
window.close()
}
}
//取得控件得绝对位置(1)
http://dotnet.csdn.net/function getoffset(e)
{
http://dotnet.csdn.net/var t=e.offsetTop;
http://dotnet.csdn.net/var l=e.offsetLeft;
http://dotnet.csdn.net/while(e=e.offsetParent)
{
t+=e.offsetTop;
l+=e.offsetLeft;
}
http://dotnet.csdn.net/var rec = http://dotnet.csdn.net/new http://dotnet.csdn.net/Array(1);
rec[0] = t;
rec[1] = l;
http://dotnet.csdn.net/return rec
}
</script>
//获得控件的绝对位置(2)
oRect.left
oRect.
//最小化,最大化,关闭
//光标停在文字最后
http://dotnet.csdn.net/function cc()
{
http://dotnet.csdn.net/var e = event.srcElement;
http://dotnet.csdn.net/var r =e.createTextRange();
r.moveStart('character',e.value.length);
r.collapse(http://dotnet.csdn.net/true);
r.select();
}
</script>
<input type=text name=text1 value=http://dotnet.csdn.net/"123" onfocus=http://dotnet.csdn.net/"cc()">
//页面进入和退出的特效
推出页面<meta http-equiv=http://dotnet.csdn.net/"Page-Exit" content=http://dotnet.csdn.net/"revealTrans(duration=x, transition=y)">
这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使
用哪种特效,取值为1-23:
0 矩形缩小
1 矩形扩大
2 圆形缩小
3 圆形扩大
4 下到上刷新
5 上到下刷新
6 左到右刷新
7 右到左刷新
8 竖百叶窗
9 横百叶窗
10 错位横百叶窗
11 错位竖百叶窗
12 点扩散
13 左右到中间刷新
14 中间到左右刷新
15 中间到上下
16 上下到中间
17 右下到左上
18 右上到左下
19 左上到右下
20 左下到右上
21 横条
22 竖条
23
//网页是否被检索
//打印分页
//设置打印
classid=http://dotnet.csdn.net/"clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase=http://dotnet.csdn.net/"http:http://dotnet.csdn.net///www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"
></object>
<input type=button value=页面设置 onclick=http://dotnet.csdn.net/"factory.printing.PageSetup()">
<input type=button value=打印预览 onclick=http://dotnet.csdn.net/"factory.printing.Preview()">
<script language=javascript>
http://dotnet.csdn.net/function window.onload()
{
http://dotnet.csdn.net/// -- advanced features
factory.printing.SetMarginMeasure(2) http://dotnet.csdn.net/// measure margins in inches
factory.printing.SetPageRange(http://dotnet.csdn.net/false, 1, 3) http://dotnet.csdn.net/// need pages from 1 to 3
factory.printing.printer = http://dotnet.csdn.net/"HP DeskJet 870C"
factory.printing.copies = 2
factory.printing.collate = true
factory.printing.paperSize = http://dotnet.csdn.net/"A4"
factory.printing.paperSource = http://dotnet.csdn.net/"Manual feed"
http://dotnet.csdn.net/// -- basic features
factory.printing.header = http://dotnet.csdn.net/"居左显示&b居中显示&b居右显示页码,第&p页/共&P页"
factory.printing.footer = http://dotnet.csdn.net/"(自定义页脚)"
factory.printing.portrait = false
factory.printing.leftMargin = 0.75
factory.printing.topMargin = 1.5
factory.printing.rightMargin = 0.75
factory.printing.bottomMargin = 1.5
}
http://dotnet.csdn.net/function Print(frame) {
factory.printing.Print(http://dotnet.csdn.net/true, frame) http://dotnet.csdn.net/// print with prompt
}
</script>
<input type=button value=http://dotnet.csdn.net/"打印本页" onclick=http://dotnet.csdn.net/"factory.printing.Print(false)">
<input type=button value=http://dotnet.csdn.net/"页面设置" onclick=http://dotnet.csdn.net/"factory.printing.PageSetup()">
<input type=button value=http://dotnet.csdn.net/"打印预览" onclick=http://dotnet.csdn.net/"factory.printing.Preview()"><br>
<a href=http://dotnet.csdn.net/"http:http://dotnet.csdn.net///www.meadroid.com/scriptx/docs/printdoc.htm?static" target=_blank>具体使用手册,更多信息,点这里</a>
//自带的打印预览
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页面设置
Web.ExecWB(10,1) 查看页面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
<style media=print>
.Noprint{display:none;}<!--用本样式在打印时隐藏非打印项目-->
.PageNext{page-break-after: always;}<!--控制分页-->
</style>
<object id=http://dotnet.csdn.net/"WebBrowser" width=0 height=0 classid=http://dotnet.csdn.net/"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<center class=http://dotnet.csdn.net/"Noprint" >
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
</p>
<p> <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
</center>
//去掉打印时的页眉页脚
http://dotnet.csdn.net/var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root=http://dotnet.csdn.net/"HKEY_CURRENT_USER";
HKEY_Path=http://dotnet.csdn.net/"\\Software\\Microsoft\\Internet Explorer\\PageSetup\http://dotnet.csdn.net/";
http://dotnet.csdn.net///设置网页打印的页眉页脚为空
http://dotnet.csdn.net/function PageSetup_Null()
{
try
{
http://dotnet.csdn.net/var Wsh=http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"WScript.Shell");
HKEY_Key=http://dotnet.csdn.net/"header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,http://dotnet.csdn.net/"");
HKEY_Key=http://dotnet.csdn.net/"footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,http://dotnet.csdn.net/"");
}
http://dotnet.csdn.net/catch(e){}
}
http://dotnet.csdn.net///设置网页打印的页眉页脚为默认值
http://dotnet.csdn.net/function PageSetup_Default()
{
try
{
http://dotnet.csdn.net/var Wsh=http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"WScript.Shell");
HKEY_Key=http://dotnet.csdn.net/"header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,http://dotnet.csdn.net/"&w&b页码,&p/&P");
HKEY_Key=http://dotnet.csdn.net/"footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,http://dotnet.csdn.net/"&u&b&d");
}
http://dotnet.csdn.net/catch(e){}
}
</script>
<input type=http://dotnet.csdn.net/"button" value=http://dotnet.csdn.net/"清空页码" onclick=PageSetup_Null()>
<input type=http://dotnet.csdn.net/"button" value=http://dotnet.csdn.net/"恢复页码" onclick=PageSetup_Default()>
//浏览器验证
{
http://dotnet.csdn.net/this.ver=navigator.appVersion
http://dotnet.csdn.net/this.dom=document.getElementById?1:0
http://dotnet.csdn.net/this.ie6=(http://dotnet.csdn.net/this.ver.indexOf(http://dotnet.csdn.net/"MSIE 6")>-1 && http://dotnet.csdn.net/this.dom)?1:0;
http://dotnet.csdn.net/this.ie5=(http://dotnet.csdn.net/this.ver.indexOf(http://dotnet.csdn.net/"MSIE 5")>-1 && http://dotnet.csdn.net/this.dom)?1:0;
http://dotnet.csdn.net/this.ie4=(document.all && !http://dotnet.csdn.net/this.dom)?1:0;
http://dotnet.csdn.net/this.ns5=(http://dotnet.csdn.net/this.dom && parseInt(http://dotnet.csdn.net/this.ver) >= 5) ?1:0;
http://dotnet.csdn.net/this.ns4=(document.layers && !http://dotnet.csdn.net/this.dom)?1:0;
http://dotnet.csdn.net/this.mac=(http://dotnet.csdn.net/this.ver.indexOf('Mac') > -1) ?1:0;
http://dotnet.csdn.net/this.ope=(navigator.userAgent.indexOf('Opera')>-1);
http://dotnet.csdn.net/this.ie=(http://dotnet.csdn.net/this.ie6 || http://dotnet.csdn.net/this.ie5 || http://dotnet.csdn.net/this.ie4)
http://dotnet.csdn.net/this.ns=(http://dotnet.csdn.net/this.ns4 || http://dotnet.csdn.net/this.ns5)
http://dotnet.csdn.net/this.bw=(http://dotnet.csdn.net/this.ie6 || http://dotnet.csdn.net/this.ie5 || http://dotnet.csdn.net/this.ie4 || http://dotnet.csdn.net/this.ns5 || http://dotnet.csdn.net/this.ns4 || http://dotnet.csdn.net/this.mac || http://dotnet.csdn.net/this.ope)
http://dotnet.csdn.net/this.nbw=(!http://dotnet.csdn.net/this.bw)
http://dotnet.csdn.net/return http://dotnet.csdn.net/this;
}
//计算内容宽和高
http://dotnet.csdn.net/function test(obj)
{
http://dotnet.csdn.net/var range = obj.createTextRange();
alert(http://dotnet.csdn.net/"内容区宽度: " + range.boundingWidth
+ http://dotnet.csdn.net/"px\r\n内容区高度: " + range.boundingHeight + http://dotnet.csdn.net/"px");
}
</SCRIPT>
<BODY>
<Textarea id=http://dotnet.csdn.net/"txt" height=http://dotnet.csdn.net/"150">sdf</textarea><INPUT type=http://dotnet.csdn.net/"button" value=http://dotnet.csdn.net/"计算内容宽度" onClick=http://dotnet.csdn.net/"test(txt)">
</BODY>
//无模式的提示框
{
window.showModelessDialog(http://dotnet.csdn.net/"javascript:alert(http://dotnet.csdn.net/""+escape(Msg)+http://dotnet.csdn.net/"http://dotnet.csdn.net/");window.close();",http://dotnet.csdn.net/"",http://dotnet.csdn.net/"status:no;resizable:no;help:no;dialogHeight:height:30px;dialogHeight:40px;");
}
//屏蔽按键
<head>
<meta http-equiv=http://dotnet.csdn.net/"Content-Type" content=http://dotnet.csdn.net/"text/html; charset=gb2312">
<noscript><meta http-equiv=http://dotnet.csdn.net/"refresh" content=http://dotnet.csdn.net/"0;url=about:noscript"></noscript>
<title>屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键</title>
</head>
<body>
<script language=http://dotnet.csdn.net/"Javascript"><!--
http://dotnet.csdn.net///屏蔽鼠标右键、Ctrl+N、Shift+F10、F11、F5刷新、退格键
http://dotnet.csdn.net///Author: meizz(梅花雨) 2002-6-18
http://dotnet.csdn.net/function document.oncontextmenu(){event.returnValue=http://dotnet.csdn.net/false;}http://dotnet.csdn.net///屏蔽鼠标右键
http://dotnet.csdn.net/function window.onhelp(){http://dotnet.csdn.net/return http://dotnet.csdn.net/false} http://dotnet.csdn.net///屏蔽F1帮助
http://dotnet.csdn.net/function document.onkeydown()
{
http://dotnet.csdn.net/if ((window.event.altKey)&&
((window.event.keyCode==37)|| http://dotnet.csdn.net///屏蔽 Alt+ 方向键 ←
(window.event.keyCode==39))) http://dotnet.csdn.net///屏蔽 Alt+ 方向键 →
{
alert(http://dotnet.csdn.net/"不准你使用ALT+方向键前进或后退网页!");
event.returnValue=http://dotnet.csdn.net/false;
}
http://dotnet.csdn.net//* 注:这还不是真正地屏蔽 Alt+ 方向键,
因为 Alt+ 方向键弹出警告框时,按住 Alt 键不放,
用鼠标点掉警告框,这种屏蔽方法就失效了。以后若
有哪位高手有真正屏蔽 Alt 键的方法,请告知。*/
http://dotnet.csdn.net/if ((event.keyCode==8) || http://dotnet.csdn.net///屏蔽退格删除键
(event.keyCode==116)|| http://dotnet.csdn.net///屏蔽 F5 刷新键
(event.ctrlKey && event.keyCode==82)){ http://dotnet.csdn.net///Ctrl + R
event.keyCode=0;
event.returnValue=http://dotnet.csdn.net/false;
}
http://dotnet.csdn.net/if (event.keyCode==122){event.keyCode=0;event.returnValue=http://dotnet.csdn.net/false;} http://dotnet.csdn.net///屏蔽F11
http://dotnet.csdn.net/if (event.ctrlKey && event.keyCode==78) event.returnValue=http://dotnet.csdn.net/false; http://dotnet.csdn.net///屏蔽 Ctrl+n
http://dotnet.csdn.net/if (event.shiftKey && event.keyCode==121)event.returnValue=http://dotnet.csdn.net/false; http://dotnet.csdn.net///屏蔽 shift+F10
http://dotnet.csdn.net/if (window.event.srcElement.tagName == http://dotnet.csdn.net/"A" && window.event.shiftKey)
window.event.returnValue = http://dotnet.csdn.net/false; http://dotnet.csdn.net///屏蔽 shift 加鼠标左键新开一网页
http://dotnet.csdn.net/if ((window.event.altKey)&&(window.event.keyCode==115)) http://dotnet.csdn.net///屏蔽Alt+F4
{
window.showModelessDialog(http://dotnet.csdn.net/"about:blank",http://dotnet.csdn.net/"",http://dotnet.csdn.net/"dialogWidth:1px;dialogheight:1px");
http://dotnet.csdn.net/return http://dotnet.csdn.net/false;
}
}
</script>
屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键
</body>
</html>
//屏蔽打印
<style>
@media print{
* {display:none}
}
</style>
//移动的图层,拖动
<script language=javascript>
http://dotnet.csdn.net/var Obj;
http://dotnet.csdn.net/function MouseDown(obj)
{
Obj=obj;
Obj.setCapture();
Obj.l=event.x-Obj.style.pixelLeft;
Obj.t=event.y-Obj.style.pixelTop;
}
http://dotnet.csdn.net/function MouseMove()
{
http://dotnet.csdn.net/if(Obj!=http://dotnet.csdn.net/null)
{
Obj.style.left = event.x-Obj.l;
Obj.style.top = event.y-Obj.t;
}
}
http://dotnet.csdn.net/function MouseUp()
{
http://dotnet.csdn.net/if(Obj!=http://dotnet.csdn.net/null)
{
Obj.releaseCapture();
Obj=http://dotnet.csdn.net/null;
}
}
</script>
2.
<div id=http://dotnet.csdn.net/"myDiv" src=http://dotnet.csdn.net/"logo.gif" ondrag=http://dotnet.csdn.net/"doDrag();" onmouseover=http://dotnet.csdn.net/"this.style.cursor='hand'" style=http://dotnet.csdn.net/"position:absolute;left=100;top=100;" onmousedown=http://dotnet.csdn.net/"doMouseDown();">
<a href=http://dotnet.csdn.net/"#" onclick=http://dotnet.csdn.net/"return false"><h1>wlecome</h1></a>
</div>
<script language=http://dotnet.csdn.net/"JavaScript" type=http://dotnet.csdn.net/"text/javascript">
http://dotnet.csdn.net/var orgMouseX;
http://dotnet.csdn.net/var orgMouseY;
http://dotnet.csdn.net/var orgObjX;
http://dotnet.csdn.net/var orgObjY;
http://dotnet.csdn.net/function doDrag()
{
http://dotnet.csdn.net/var myObject=document.all.myDiv;
http://dotnet.csdn.net/var x=event.clientX;
http://dotnet.csdn.net/var y=event.clientY;
myObject.style.left=x-(orgMouseX-orgObjX);
myObject.style.top=y-(orgMouseY-orgObjY);
}
http://dotnet.csdn.net/function doMouseDown()
{
orgMouseX=event.clientX;
orgMouseY=event.clientY;
orgObjX=parseInt(document.all.myDiv.style.left);
orgObjY=parseInt(document.all.myDiv.style.top);
}
</script>
//文档状态改变
<script>
http://dotnet.csdn.net/var doc=window.frames[http://dotnet.csdn.net/"f"].document;
http://dotnet.csdn.net/function s(){
http://dotnet.csdn.net/if (doc.readyState==http://dotnet.csdn.net/"complete"){
document.all.f.style.height=doc.body.scrollHeight
document.all.f.style.width=doc.body.scrollWidth
}
}
doc.onreadystatechange=s
</script>
http://dotnet.csdn.net/
//刷新后不变的文本框
//访问剪贴板
//操作COOKIE
{
document.cookie = sName + http://dotnet.csdn.net/"=" + escape(sValue) + http://dotnet.csdn.net/"; ";
}
http://dotnet.csdn.net/function GetCookie(sName)
{
http://dotnet.csdn.net/var aCookie = document.cookie.split(http://dotnet.csdn.net/"; ");
for (http://dotnet.csdn.net/var i=0; i < aCookie.length; i++)
{
http://dotnet.csdn.net/var aCrumb = aCookie[i].split(http://dotnet.csdn.net/"=");
http://dotnet.csdn.net/if (sName == aCrumb[0])
http://dotnet.csdn.net/return unescape(aCrumb[1]);
}
}
http://dotnet.csdn.net/function DelCookie(sName)
{
document.cookie = sName + http://dotnet.csdn.net/"=" + escape(sValue) + http://dotnet.csdn.net/"; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}
//setTimeout增加参数
http://dotnet.csdn.net/var _st = window.setTimeout;
window.setTimeout = http://dotnet.csdn.net/function(fRef, mDelay) {
http://dotnet.csdn.net/if(typeof fRef == 'http://dotnet.csdn.net/function'){
http://dotnet.csdn.net/var argu = http://dotnet.csdn.net/Array.prototype.slice.call(arguments,2);
http://dotnet.csdn.net/var f = (http://dotnet.csdn.net/function(){ fRef.apply(http://dotnet.csdn.net/null, argu); });
http://dotnet.csdn.net/return _st(f, mDelay);
}
http://dotnet.csdn.net/return _st(fRef,mDelay);
}
http://dotnet.csdn.net/function test(x){
alert(x);
}
window.setTimeout(test,1000,'fason');
</script>
//自定义的apply,call
http://dotnet.csdn.net/if (obj) obj.constructor.prototype._caller = http://dotnet.csdn.net/this;
http://dotnet.csdn.net/var argus = http://dotnet.csdn.net/new http://dotnet.csdn.net/Array();
for (http://dotnet.csdn.net/var i=0;i<argu.length;i++)
argus[i] = http://dotnet.csdn.net/"argu[" + i + http://dotnet.csdn.net/"]";
http://dotnet.csdn.net/var r;
eval(http://dotnet.csdn.net/"r = " + (obj ? (http://dotnet.csdn.net/"obj._caller(" + argus.join(http://dotnet.csdn.net/",") + http://dotnet.csdn.net/");") : (http://dotnet.csdn.net/"this(" + argus.join(http://dotnet.csdn.net/",") + http://dotnet.csdn.net/");")));
http://dotnet.csdn.net/return r;
};
Function.prototype.call = http://dotnet.csdn.net/function (obj) {
http://dotnet.csdn.net/var argu = http://dotnet.csdn.net/new http://dotnet.csdn.net/Array();
for (http://dotnet.csdn.net/var i=1;i<arguments.length;i++)
argu[i-1] = arguments[i];
http://dotnet.csdn.net/return http://dotnet.csdn.net/this.apply(obj, argu);
};
//下载文件
{
try
{
http://dotnet.csdn.net/var xmlHTTP=http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"Microsoft.XMLHTTP");
xmlHTTP.open(http://dotnet.csdn.net/"Get",strRemoteURL,http://dotnet.csdn.net/false);
xmlHTTP.send();
http://dotnet.csdn.net/var adodbStream=http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"ADODB.Stream");
adodbStream.Type=1;http://dotnet.csdn.net///1=adTypeBinary
adodbStream.Open();
adodbStream.write(xmlHTTP.responseBody);
adodbStream.SaveToFile(strLocalURL,2);
adodbStream.Close();
adodbStream=http://dotnet.csdn.net/null;
xmlHTTP=http://dotnet.csdn.net/null;
}
http://dotnet.csdn.net/catch(e)
{
window.confirm(http://dotnet.csdn.net/"下载URL出错!");
}
http://dotnet.csdn.net///window.confirm(http://dotnet.csdn.net/"下载完成.");
}
//检验连接是否有效
//组件是否安装
isComponentInstalled("{6B053A4B-A7EC-4D3D-4567-B8FF8A1A5739}", "componentID"))
//检查网页是否存在
{
http://dotnet.csdn.net/var xmlhttp = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"Microsoft.XMLHTTP");
xmlhttp.Open(http://dotnet.csdn.net/"GET",URL, http://dotnet.csdn.net/false);
try
{
xmlhttp.Send();
http://dotnet.csdn.net/var result = xmlhttp.status;
}
http://dotnet.csdn.net/catch(e) {http://dotnet.csdn.net/return(http://dotnet.csdn.net/false); }
http://dotnet.csdn.net/if(result==200)
{
http://dotnet.csdn.net/return http://dotnet.csdn.net/true;
}
xmlhttp = http://dotnet.csdn.net/null;
http://dotnet.csdn.net/return http://dotnet.csdn.net/false;
}
//连接数据库
http://dotnet.csdn.net///用 JavaScript 写服务器端连接数据库的代码示例
http://dotnet.csdn.net/var conn = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"ADODB.Connection");
conn.Open(http://dotnet.csdn.net/"Provider=SQLOLEDB.1; Data Source=localhost; User ID=sa; "
+http://dotnet.csdn.net/"Password=; Initial Catalog=pubs");
http://dotnet.csdn.net/var rs = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"ADODB.Recordset");
http://dotnet.csdn.net/var sql=http://dotnet.csdn.net/"select * from authors";
rs.open(sql, conn);
shtml = http://dotnet.csdn.net/"<table width='100%' border=1>";
shtml +=http://dotnet.csdn.net/"<tr bgcolor='#f4f4f4'><td>au_id</td><td>au_lname</td><td>au_fname</td><td>phone</td><td>address</td><td> city</td><td>state</td><td>zip</td></tr>";
http://dotnet.csdn.net/while(!rs.EOF)
{
shtml += http://dotnet.csdn.net/"<tr><td>" + rs(http://dotnet.csdn.net/"au_id") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"au_lname") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"au_fname") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"phone") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"address") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"city") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"state") + http://dotnet.csdn.net/"</td><td>" + rs(http://dotnet.csdn.net/"zip") + http://dotnet.csdn.net/"</td></tr>";
rs.moveNext;
}
shtml += http://dotnet.csdn.net/"</table>";
document.write(shtml);
rs.close();
rs = http://dotnet.csdn.net/null;
conn.close();
conn = http://dotnet.csdn.net/null;
</script>
//使用数据岛
<body>
srno:<input type=text datasrc=#xmldate DataFLD=srno size=http://dotnet.csdn.net/"76"><BR>
times:<input type=text datasrc=#xmldate DataFLD=times size=http://dotnet.csdn.net/"76"><BR>
<input id=http://dotnet.csdn.net/"first" TYPE=button value=http://dotnet.csdn.net/"<< 第一条记录" onclick=http://dotnet.csdn.net/"xmldate.recordset.moveFirst()">
<input id=http://dotnet.csdn.net/"prev" TYPE=button value=http://dotnet.csdn.net/"<上一条记录" onclick=http://dotnet.csdn.net/"xmldate.recordset.movePrevious()">
<input id=http://dotnet.csdn.net/"next" TYPE=button value=http://dotnet.csdn.net/"下一条记录>" onclick=http://dotnet.csdn.net/"xmldate.recordset.moveNext()">
<input id=http://dotnet.csdn.net/"last" TYPE=button value=http://dotnet.csdn.net/"最后一条记录>>" onclick=http://dotnet.csdn.net/"xmldate.recordset.moveLast()">
<input id=http://dotnet.csdn.net/"Add" TYPE=button value=http://dotnet.csdn.net/"添加新记录" onclick=http://dotnet.csdn.net/"xmldate.recordset.addNew()">
<XML ID=http://dotnet.csdn.net/"xmldate">
<infolist>
<info ><srno>20041025-01</srno><times>http://dotnet.csdn.net/null</times></info>
<info ><srno>20041101-09</srno><times>2004年10月1日2点22分0秒</times></info>
</infolist>
</XML>
</body>
</html>
//获得参数
<a href=http://dotnet.csdn.net/"javascript:location.href=location.href + '?a=1&b=2'">search</a>
<script language=http://dotnet.csdn.net/"JavaScript">
<!--
http://dotnet.csdn.net/var a = location.search.substr(1);
http://dotnet.csdn.net/if(a.length>0)
{
http://dotnet.csdn.net/var re = /([^&]*?)\=([^&]*)/g
http://dotnet.csdn.net/var s = a.match(re);
for(http://dotnet.csdn.net/var i= 0;i<s.length;i++)
{
alert(s[i]);
alert(s[i].split(http://dotnet.csdn.net/"=")[1]);
}
}
http://dotnet.csdn.net///-->
</script>
</body>
//可编辑SELECT
<option value=http://dotnet.csdn.net/"1">11111111<option>
<option value=http://dotnet.csdn.net/"2">222222</option>
<option value=http://dotnet.csdn.net/"3">333333</option>
</select>
</span>
//设置光标位置
{
http://dotnet.csdn.net/var control = document.activeElement;
textbox.focus();
http://dotnet.csdn.net/var rang = document.selection.createRange();
rang.setEndPoint(http://dotnet.csdn.net/"StartToStart",textbox.createTextRange())
control.focus();
http://dotnet.csdn.net/return rang.text.length;
}
http://dotnet.csdn.net/function setCaret(textbox,pos)
{
try
{
http://dotnet.csdn.net/var r =textbox.createTextRange();
r.moveStart('character',pos);
r.collapse(http://dotnet.csdn.net/true);
r.select();
}
http://dotnet.csdn.net/catch(e)
{}
}
http://dotnet.csdn.net/function selectLength(textbox,start,len)
{
try
{
http://dotnet.csdn.net/var r =textbox.createTextRange();
r.moveEnd('character',len-(textbox.value.length-start));
r.moveStart('character',start);
r.select();
}
http://dotnet.csdn.net/catch(e)
{http://dotnet.csdn.net///alert(e.description)}
}
http://dotnet.csdn.net/function insertAtCaret(textbox,text)
{
textbox.focus();
document.selection.createRange().text = text;
}
//页内查找
{
http://dotnet.csdn.net/var txt, i, found,n = 0;
http://dotnet.csdn.net/if (str == http://dotnet.csdn.net/"")
{
http://dotnet.csdn.net/return http://dotnet.csdn.net/false;
}
txt = document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != http://dotnet.csdn.net/false; i++)
{
txt.moveStart(http://dotnet.csdn.net/"character", 1);
txt.moveEnd(http://dotnet.csdn.net/"textedit");
}
http://dotnet.csdn.net/if (found)
{
txt.moveStart(http://dotnet.csdn.net/"character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else
{
http://dotnet.csdn.net/if (n > 0)
{
n = 0;
findInPage(str);
}
else
{
alert(str + http://dotnet.csdn.net/"... 您要找的文字不存在。\n \n请试着输入页面中的关键字再次查找!");
}
}
http://dotnet.csdn.net/return http://dotnet.csdn.net/false;
}
//书
http://www.wrclub.net/down/listdown.aspx?id=1341http://dotnet.csdn.net/
//操作EXECL
http://dotnet.csdn.net/function jStartExcel() {
http://dotnet.csdn.net/var xls = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject ( http://dotnet.csdn.net/"Excel.Application" );
xls.visible = http://dotnet.csdn.net/true;
http://dotnet.csdn.net/var newBook = xls.Workbooks.Add;
newBook.Worksheets.Add;
newBook.Worksheets(1).Activate;
xls.ActiveWorkBook.ActiveSheet.PageSetup.Orientation = 2;
xls.ActiveWorkBook.ActiveSheet.PageSetup.PaperSize = 5;
newBook.Worksheets(1).Columns(http://dotnet.csdn.net/"A").columnwidth=50;
newBook.Worksheets(1).Columns(http://dotnet.csdn.net/"A").WrapText = http://dotnet.csdn.net/true;
newBook.Worksheets(1).Columns(http://dotnet.csdn.net/"B").columnwidth=50;
newBook.Worksheets(1).Columns(http://dotnet.csdn.net/"B").WrapText = http://dotnet.csdn.net/true;
newBook.Worksheets(1).Range(http://dotnet.csdn.net/"A1:B1000").NumberFormat = http://dotnet.csdn.net/"0";
newBook.Worksheets(1).Range(http://dotnet.csdn.net/"A1:B1000").HorizontalAlignment = -4131;
newBook.Worksheets(1).Cells(1,1).Interior.ColorIndex=http://dotnet.csdn.net/"15";
newBook.Worksheets(1).Cells(1,1).value=http://dotnet.csdn.net/"First Column, First Cell";
newBook.Worksheets(1).Cells(2,1).value=http://dotnet.csdn.net/"First Column, Second Cell";
newBook.Worksheets(1).Cells(1,2).value=http://dotnet.csdn.net/"Second Column, First Cell";
newBook.Worksheets(1).Cells(2,2).value=http://dotnet.csdn.net/"Second Column, Second Cell";
newBook.Worksheets(1).Name=http://dotnet.csdn.net/"My First WorkSheet";
}
</script>
//自定义提示条
<script Language=http://dotnet.csdn.net/"JavaScript">
http://dotnet.csdn.net///***********默认设置定义.*********************
tPopWait=50;http://dotnet.csdn.net///停留tWait豪秒后显示提示。
tPopShow=5000;http://dotnet.csdn.net///显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;
http://dotnet.csdn.net///***************内部变量定义*****************
sPop=http://dotnet.csdn.net/null;
curShow=http://dotnet.csdn.net/null;
tFadeOut=http://dotnet.csdn.net/null;
tFadeIn=http://dotnet.csdn.net/null;
tFadeWaiting=http://dotnet.csdn.net/null;
document.write(http://dotnet.csdn.net/"<style type='text/css'id='defaultPopStyle'>");
document.write(http://dotnet.csdn.net/".cPopText { background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write(http://dotnet.csdn.net/"</style>");
document.write(http://dotnet.csdn.net/"<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");
http://dotnet.csdn.net/function showPopupText(){
http://dotnet.csdn.net/var o=event.srcElement;
MouseX=event.x;
MouseY=event.y;
http://dotnet.csdn.net/if(o.alt!=http://dotnet.csdn.net/null && o.alt!=http://dotnet.csdn.net/""){o.dypop=o.alt;o.alt=http://dotnet.csdn.net/""};
http://dotnet.csdn.net/if(o.title!=http://dotnet.csdn.net/null && o.title!=http://dotnet.csdn.net/""){o.dypop=o.title;o.title=http://dotnet.csdn.net/""};
http://dotnet.csdn.net/if(o.dypop!=sPop) {
sPop=o.dypop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
http://dotnet.csdn.net/if(sPop==http://dotnet.csdn.net/null || sPop==http://dotnet.csdn.net/"") {
dypopLayer.innerHTML=http://dotnet.csdn.net/"";
dypopLayer.style.filter=http://dotnet.csdn.net/"Alpha()";
dypopLayer.filters.Alpha.opacity=0;
}
http://dotnet.csdn.net/else {
http://dotnet.csdn.net/if(o.dyclass!=http://dotnet.csdn.net/null) popStyle=o.dyclass
http://dotnet.csdn.net/else popStyle=http://dotnet.csdn.net/"cPopText";
curShow=setTimeout(http://dotnet.csdn.net/"showIt()",tPopWait);
}
}
}
http://dotnet.csdn.net/function showIt(){
dypopLayer.className=popStyle;
dypopLayer.innerHTML=sPop;
popWidth=dypopLayer.clientWidth;
popHeight=dypopLayer.clientHeight;
http://dotnet.csdn.net/if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
http://dotnet.csdn.net/else popLeftAdjust=0;
http://dotnet.csdn.net/if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
http://dotnet.csdn.net/else popTopAdjust=0;
dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
dypopLayer.style.filter=http://dotnet.csdn.net/"Alpha(Opacity=0)";
fadeOut();
}
http://dotnet.csdn.net/function fadeOut(){
http://dotnet.csdn.net/if(dypopLayer.filters.Alpha.opacity<popOpacity) {
dypopLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout(http://dotnet.csdn.net/"fadeOut()",1);
}
http://dotnet.csdn.net/else {
dypopLayer.filters.Alpha.opacity=popOpacity;
tFadeWaiting=setTimeout(http://dotnet.csdn.net/"fadeIn()",tPopShow);
}
}
http://dotnet.csdn.net/function fadeIn(){
http://dotnet.csdn.net/if(dypopLayer.filters.Alpha.opacity>0) {
dypopLayer.filters.Alpha.opacity-=1;
tFadeIn=setTimeout(http://dotnet.csdn.net/"fadeIn()",1);
}
}
document.onmouseover=showPopupText;
</script>
//插入文字
http://dotnet.csdn.net/var oSource = window.event.srcElement;
http://dotnet.csdn.net/if(oSource.tagName!=http://dotnet.csdn.net/"DIV")
http://dotnet.csdn.net/return http://dotnet.csdn.net/false;
http://dotnet.csdn.net/var sel = document.selection;
http://dotnet.csdn.net/if (sel!=http://dotnet.csdn.net/null) {
http://dotnet.csdn.net/var rng = sel.createRange();
http://dotnet.csdn.net/if (rng!=http://dotnet.csdn.net/null)
rng.pasteHTML(http://dotnet.csdn.net/"<font color=red>插入文字</font>");
}
}
//netscapte下操作xml
//判断键值
//禁止FSO
regsvr32 /u scrrun.dll
2.修改PROGID
HKEY_CLASSES_ROOT\Scripting.FileSystemObject
Scripting.FileSystemObject
3.对于使用object的用户,修改HKEY_CLASSES_ROOT\Scripting.
//省略号
//检测media play版本
//图象按比例
//细线SELECT
{
http://dotnet.csdn.net/var objWMIService = GetObject(http://dotnet.csdn.net/"Winmgmts:root\cimv2");
for(e = http://dotnet.csdn.net/new Enumerator(objWMIService) ; !e.atEnd() ; e.moveNext())
{
http://dotnet.csdn.net/var getComputer = e.item();
http://dotnet.csdn.net/return getComputer.Name;
}
}
//条件编译
http://dotnet.csdn.net//*@cc_on @*/
http://dotnet.csdn.net//*@if (@_win32 && @_jscript_version>5)
function window.confirm(str)
{
execScript("n = msgbox('"+ str +"', 257)", "vbscript");
return(n == 1);
}
@end @*/
</script>
//取得innerText
<!--
http://dotnet.csdn.net/var xmlDoc = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"Msxml2.DOMDocument.4.0");
http://dotnet.csdn.net/var currNode;
xmlDoc.async = http://dotnet.csdn.net/false;
xmlDoc.async = http://dotnet.csdn.net/false;
xmlDoc.loadXML(http://dotnet.csdn.net/"<TABLENAME> 你好你阿三 大法 司法等四 </TABLENAME>");
currNode = xmlDoc.documentElement;
http://dotnet.csdn.net/var s = currNode.xml;
http://dotnet.csdn.net/var r = /\<([^\>\s]*?)[^\>]*?\>([^\<]*?)\<\/\1\>/
http://dotnet.csdn.net/var b = s.replace(r,http://dotnet.csdn.net/"$2");
alert(b);
http://dotnet.csdn.net///-->
</SCRIPT>
//mergeAttributes 复制所有读/写标签属性到指定元素。
http://dotnet.csdn.net/function fnMerge(){
oSource.children[1].mergeAttributes(oSource.children[0]);
}
</SCRIPT>
<SPAN ID=oSource>
<DIV
ID=http://dotnet.csdn.net/"oDiv"
ATTRIBUTE1=http://dotnet.csdn.net/"true"
ATTRIBUTE2=http://dotnet.csdn.net/"true"
onclick=http://dotnet.csdn.net/"alert('click');"
onmouseover=http://dotnet.csdn.net/"this.style.color='#0000FF';"
onmouseout=http://dotnet.csdn.net/"this.style.color='#000000';"
>
This is a sample <B>DIV</B> element.
</DIV>
<DIV ID=http://dotnet.csdn.net/"oDiv2">
This is another sample <B>DIV</B> element.
</DIV>
</SPAN>
<INPUT
TYPE=http://dotnet.csdn.net/"button"
VALUE=http://dotnet.csdn.net/"Merge Attributes"
onclick=http://dotnet.csdn.net/"fnMerge()"
>
<http://dotnet.csdn.net/http://dotnet.csdn.net/select style=http://dotnet.csdn.net/"margin:-2px;">
<http://dotnet.csdn.net/http://dotnet.csdn.net/option>1111<http://dotnet.csdn.net//http://dotnet.csdn.net/option>
<http://dotnet.csdn.net/http://dotnet.csdn.net/option>11111111111111<http://dotnet.csdn.net//http://dotnet.csdn.net/option>
<http://dotnet.csdn.net/http://dotnet.csdn.net/option>111111111<http://dotnet.csdn.net//http://dotnet.csdn.net/option>
<http://dotnet.csdn.net//http://dotnet.csdn.net/select><http://dotnet.csdn.net//http://dotnet.csdn.net/span>
//Import
for( http://dotnet.csdn.net/var i=0; i<arguments.length; i++ ) {
http://dotnet.csdn.net/var file = arguments[i];
http://dotnet.csdn.net/if ( file.match(/\.js$/i))
document.write('<script type=http://dotnet.csdn.net/"text/javascript\http://dotnet.csdn.net/" src=http://dotnet.csdn.net/"' + file + 'http://dotnet.csdn.net/"></sc' + 'ript>');
else
document.write('<style type=http://dotnet.csdn.net/"text/csshttp://dotnet.csdn.net/">@import http://dotnet.csdn.net/"' + file + 'http://dotnet.csdn.net/" ;</style>');
}
};
//js枚举
<!--
http://dotnet.csdn.net///图片按比例缩放
http://dotnet.csdn.net/var flag=http://dotnet.csdn.net/false;
http://dotnet.csdn.net/function DrawImage(ImgD){
http://dotnet.csdn.net/var image=http://dotnet.csdn.net/new Image();
http://dotnet.csdn.net/var iwidth = 80; http://dotnet.csdn.net///定义允许图片宽度
http://dotnet.csdn.net/var iheight = 80; http://dotnet.csdn.net///定义允许图片高度
image.src=http://dotnet.csdn.net/ImgD.src;
http://dotnet.csdn.net/if(image.width>0 && image.height>0){
flag=http://dotnet.csdn.net/true;
http://dotnet.csdn.net/if(image.width/image.height>= iwidth/iheight){
http://dotnet.csdn.net/if(image.width>iwidth){
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}http://dotnet.csdn.net/else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+http://dotnet.csdn.net/"×"+image.height;
}
http://dotnet.csdn.net/else{
http://dotnet.csdn.net/if(image.height>iheight){
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height;
}http://dotnet.csdn.net/else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+http://dotnet.csdn.net/"×"+image.height;
}
}
}
http://dotnet.csdn.net///-->
</script>
<img src=http://dotnet.csdn.net/".." onload = http://dotnet.csdn.net/"DrawImage(this)">
<SCRIPT>
http://dotnet.csdn.net/var flash=http://dotnet.csdn.net/"";
WMPVersion= oClientCaps.getComponentVersion(http://dotnet.csdn.net/"{22D6F312-B0F6-11D0-94AB-0080C74C7E95}",http://dotnet.csdn.net/"ComponentID");
http://dotnet.csdn.net/if (WMPVersion != http://dotnet.csdn.net/"") {
flash = http://dotnet.csdn.net/"";
http://dotnet.csdn.net/var version = WMPVersion.split(http://dotnet.csdn.net/",");
http://dotnet.csdn.net/var i;
for (i = 0; i < version.length; i++) {
http://dotnet.csdn.net/if (i != 0)
flash += http://dotnet.csdn.net/".";
flash += version[i];
}
document.write(http://dotnet.csdn.net/"您的Windows Media Player 版本是:"+flash+http://dotnet.csdn.net/"<p>");
}
</SCRIPT>
overflow: hidden; text-overflow:ellipsis">
<NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR>
</DIV>
<meta http-equiv=http://dotnet.csdn.net/"Content-Type" content=http://dotnet.csdn.net/"text/html; charset=gb2312">
<head>
<script language=http://dotnet.csdn.net/"javascript">
http://dotnet.csdn.net/var ie =navigator.appName==http://dotnet.csdn.net/"Microsoft Internet Explorer"?http://dotnet.csdn.net/true:http://dotnet.csdn.net/false;
http://dotnet.csdn.net/function keyDown(e)
{
http://dotnet.csdn.net/if(!ie)
{
http://dotnet.csdn.net/var nkey=e.which;
http://dotnet.csdn.net/var iekey='现在是ns浏览器';
http://dotnet.csdn.net/var realkey=http://dotnet.csdn.net/String.fromCharCode(e.which);
}
http://dotnet.csdn.net/if(ie)
{
http://dotnet.csdn.net/var iekey=event.keyCode;
http://dotnet.csdn.net/var nkey='现在是ie浏览器';
http://dotnet.csdn.net/var realkey=http://dotnet.csdn.net/String.fromCharCode(event.keyCode);
http://dotnet.csdn.net/if(event.keyCode==32){realkey='\' 空格\''}
http://dotnet.csdn.net/if(event.keyCode==13){realkey='\' 回车\''}
http://dotnet.csdn.net/if(event.keyCode==27){realkey='\' Esc\''}
http://dotnet.csdn.net/if(event.keyCode==16){realkey='\' Shift\''}
http://dotnet.csdn.net/if(event.keyCode==17){realkey='\' Ctrl\''}
http://dotnet.csdn.net/if(event.keyCode==18){realkey='\' Alt\''}
}
alert('ns浏览器中键值:'+nkey+'\n'+'ie浏览器中键值:'+iekey+'\n'+'实际键为'+realkey);
}
document.onkeydown = keyDown;
</script>
</head>
<body>
http://dotnet.csdn.net///Javascript Document.
<hr>
<center>
<h3>请按任意一个键。。。。</h3>
</center>
</body>
</html>
doc = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"Microsoft.XMLDOM")
->>
doc = (http://dotnet.csdn.net/new DOMParser()).parseFromString(sXML,'text/xml')
{
http://dotnet.csdn.net/var xmlhttp = http://dotnet.csdn.net/new http://dotnet.csdn.net/ActiveXObject(http://dotnet.csdn.net/"microsoft.xmlhttp");
xmlhttp.Open(http://dotnet.csdn.net/"GET",URL, http://dotnet.csdn.net/false);
try
{
xmlhttp.Send();
}
http://dotnet.csdn.net/catch(e){}
http://dotnet.csdn.net/finally
{
http://dotnet.csdn.net/var result = xmlhttp.responseText;
http://dotnet.csdn.net/if(result)
{
http://dotnet.csdn.net/if(xmlhttp.Status==200)
{
http://dotnet.csdn.net/return(http://dotnet.csdn.net/true);
}
http://dotnet.csdn.net/else
{
http://dotnet.csdn.net/return(http://dotnet.csdn.net/false);
}
}
http://dotnet.csdn.net/else
{
http://dotnet.csdn.net/return(http://dotnet.csdn.net/false);
}
}
}
//POST代替FORM
Function URLEncoding(vstrIn)
strReturn = http://dotnet.csdn.net/""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & http://dotnet.csdn.net/"%" & Hex(Hight8) & http://dotnet.csdn.net/"%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function
Function bytes2BSTR(vIn)
strReturn = http://dotnet.csdn.net/""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
dim strA,oReq
strA = URLEncoding(http://dotnet.csdn.net/"submit1=Submit&text1=中文")
set oReq = CreateObject(http://dotnet.csdn.net/"MSXML2.XMLHTTP")
oReq.open http://dotnet.csdn.net/"POST",http://dotnet.csdn.net/"http:http://dotnet.csdn.net///ServerName/VDir/TstResult.asp",false
oReq.setRequestHeader http://dotnet.csdn.net/"Content-Length",Len(strA)
oReq.setRequestHeader http://dotnet.csdn.net/"CONTENT-TYPE",http://dotnet.csdn.net/"application/x-www-form-urlencoded"
oReq.send strA
msgbox bytes2BSTR(oReq.responseBody)
</SCRIPT>
//readyState是xmlhttp返回数据的进度,0=载入中,1=未初始化,2=已载入,3=运行中,4=完成
event.dataTransfer.setData(http://dotnet.csdn.net/"URL", oImage.src);
sImageURL = event.dataTransfer.getData(http://dotnet.csdn.net/"URL")
(2)普通访问
window.clipboardData.setData(http://dotnet.csdn.net/"Text",oSource.innerText);
window.clipboardData.getData(http://dotnet.csdn.net/"Text");
<HEAD>
<META NAME=http://dotnet.csdn.net/"save" CONTENT=http://dotnet.csdn.net/"history">
<STYLE>
.sHistory {behavior:url(#default#savehistory);}
</STYLE>
</HEAD>
<BODY>
<INPUT class=sHistory type=text id=oPersistInput>
</BODY>
</HTML>
<p style=http://dotnet.csdn.net/"page-break-after:always">page2</p>
其中属性值有以下一些:
属性值为http://dotnet.csdn.net/"all": 文件将被检索,且页上链接可被查询;
属性值为http://dotnet.csdn.net/"none": 文件不被检索,而且不查询页上的链接;
属性值为http://dotnet.csdn.net/"index": 文件将被检索;
属性值为http://dotnet.csdn.net/"follow": 查询页上的链接;
属性值为http://dotnet.csdn.net/"noindex": 文件不检索,但可被查询链接;
属性值为http://dotnet.csdn.net/"nofollow":
<param name=http://dotnet.csdn.net/"Command" value=http://dotnet.csdn.net/"Minimize"></object>
<object id=max classid=http://dotnet.csdn.net/"clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name=http://dotnet.csdn.net/"Command" value=http://dotnet.csdn.net/"Maximize"></object>
<OBJECT id=close classid=http://dotnet.csdn.net/"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME=http://dotnet.csdn.net/"Command" value=http://dotnet.csdn.net/"Close"></OBJECT>
<input type=button value=最小化 onclick=min.Click()>
<input type=button value=最大化 onclick=max.Click()>
<input type=button value=关闭 onclick=close.Click()>
<META HTTP-EQUIV=http://dotnet.csdn.net/"Cache-Control" CONTENT=http://dotnet.csdn.net/"no-cache, must-revalidate">
<META HTTP-EQUIV=http://dotnet.csdn.net/"expires" CONTENT=http://dotnet.csdn.net/"0">
<input type=button value=导出收藏夹 onclick=http://dotnet.csdn.net/"window.external.ImportExportFavorites(false,'http:http://dotnet.csdn.net///localhost');">
<input type=button value=整理收藏夹 onclick=http://dotnet.csdn.net/"window.external.ShowBrowserUI('OrganizeFavorites', null)">
<input type=button value=语言设置 onclick=http://dotnet.csdn.net/"window.external.ShowBrowserUI('LanguageDialog', null)">
<input type=button value=加入收藏夹 onclick=http://dotnet.csdn.net/"window.external.AddFavorite('http:http://dotnet.csdn.net///www.google.com/', 'google')">
<input type=button value=加入到频道 onclick=http://dotnet.csdn.net/"window.external.addChannel('http:http://dotnet.csdn.net///www.google.com/')">
<input type=button value=加入到频道 onclick=http://dotnet.csdn.net/"window.external.showBrowserUI('PrivacySettings',null)">

浙公网安备 33010602011771号