//打開模式對話框
function doSelectUser(txtId)
{
strFeatures=
middle=yes ;help=no;status=no;scroll=no
var url
url=
strReturn=window
//返回模式對話框的值
function okbtn_onclick()
{
var commstr=
window
window
}
全屏幕打開 IE 窗口
var winWidth=screen
var winHeight=screen
window
break
//腳本中中使用xml
function initialize() {
var xmlDoc
var xslDoc
xmlDoc = new ActiveXObject(
xmlDoc
xslDoc = new ActiveXObject(
xslDoc
xmlDoc
xslDoc
folderTree
}
一
一
/^(
/^\d+$/
/^
function isTime(str)
{
var a = str
if (a == null) {alert(
if (a[
{
alert(
return false
}
return true;
}
function strDateTime(str)
{
var r = str
if(r==null)return false;
var d= new Date(r[
return (d
}
function strDateTime(str)
{
var reg = /^(\d{
var r = str
if(r==null)return false;
var d= new Date(r[
return (d
}
<input onblur=
<input onblur=
<input onblur=
/^([a
window
window
window
function ismail(mail)
{
return(new RegExp(/^\w+((
}
function isIdCardNo(num)
{
if (isNaN(num)) {alert(
var len = num
if (len ==
re = new RegExp(/^(\d{
else if (len ==
re = new RegExp(/^(\d{
else {alert(
var a = num
if (a != null)
{
if (len==
{
var D = new Date(
var B = D
}
else
{
var D = new Date(a[
var B = D
}
if (!B) {alert(
}
return true;
}
畫圖:
<OBJECT
id=S
height=
width=
classid=
</OBJECT>
<SCRIPT>
S
S
S
</SCRIPT>
寫注冊表
<SCRIPT>
var WshShell = WScript
WshShell
WshShell
var bKey = WshShell
WScript
WshShell
WshShell
WshShell
</SCRIPT>
TABLAE相關(客戶端動態增加行列)
<HTML>
<SCRIPT LANGUAGE=
function numberCells() {
var count=
for (i=
for (j=
document
count++;
}
}
}
</SCRIPT>
<BODY onload=
<TABLE id=mytable border=
<TR><TH> </TH><TH> </TH><TH> </TH><TH> </TH></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
</TABLE>
</BODY>
</HTML>
1.身份證嚴格驗證
<script>
var aCity={
function cidInfo(sId){
var iSum=
var info=
if(!/^\d{
sId=sId
if(aCity[parseInt(sId
sBirthday=sId
var d=new Date(sBirthday
if(sBirthday!=(d
for(var i =
if(iSum%
return aCity[parseInt(sId
}
document
document
document
document
</script>
2.驗證IP地址
<SCRIPT LANGUAGE=
function isip(s){
var check=function(v){try{return (v<=
var re=s
return (re
}
var s=
alert(isip(s))
</SCRIPT>
3.加sp
<HTML XMLNS:IE>
<meta http
<IE:Download ID=
<title>Chromeless Window</title>
<SCRIPT LANGUAGE=
/*
/*
This following code are designed and writen by Windy_sk <>
You can use it freely
*/
/*
var CW_width=
var CW_height=
var CW_top=
var CW_left=
var CW_url=
var New_CW= window
var CW_Body= New_CW
var content=
var CSStext=
//Build Window
include
function insert_content(){
var temp =
CW_Body
CW_Body
CW_Body
content = content
temp +=
temp +=
temp +=
temp +=
temp +=
temp +=
temp +=
temp +=
temp +=
temp +=
temp += content;
temp +=
temp +=
CW_Body
}
setTimeout(
var if_max = true;
function show_CW(){
window
if(if_max){
New_CW
if(typeof(New_CW
New_CW
New_CW
}
}else{
New_CW
New_CW
}
}
window
window
// Move Window
var drag_x
function drag_move(e){
if (draging){
New_CW
return false;
}
}
function drag_down(e){
if(e
if(New_CW
drag_x=e
drag_y=e
draging=true;
e
}
function drag_up(e){
draging=false;
e
if(New_CW
CW_top = e
CW_left = e
}
</SCRIPT>
</HTML>
貼兩個關於treeview的
<script language=
<!
//初始化選中節點
function initchecknode()
{
var node=TreeView
node
setcheck(node
FindCheckedFromNode(TreeView
}
//oncheck事件
function tree_oncheck(tree)
{
var node=tree
var Pchecked=tree
setcheck(node
document
document
FindCheckedFromNode(TreeView
}
//設置子節點選中
function setcheck(node
{
var i;
var ChildNode=new Array();
ChildNode=node
if(parseInt(ChildNode
return;
else
{
for(i=
{
var cNode;
cNode=ChildNode[i];
if(parseInt(cNode
setcheck(cNode
cNode
}
}
}
//獲取所有節點狀態
function FindCheckedFromNode(node) {
var i =
var nodes = new Array();
nodes = node
for (i =
var cNode;
cNode=nodes[i];
if (cNode
AddChecked(cNode);
else
AddUnChecked(cNode);
if (parseInt(cNode
FindCheckedFromNode(cNode);
}
}
}
//添加選中節點
function AddChecked(node) {
document
document
}
//添加未選中節點
function AddUnChecked(node) {
document
document
}
//
</script>
treeview中如何在服務器端得到客戶端設置後的節點選中狀態
<script language=
private void Button
{
Response
}
</script>
<script language=
function set_check()
{
var nodeindex =
var node=TreeView
node
TreeView
}
</script>
三個實用的小技巧:關閉輸入法
關閉輸入法
本文字框輸入法被關閉
語法
範例
本文字框禁止貼上文字
語法
範例
本文字框禁止複製
語法
範例
//================================
//Cookie操作
//================================
function getCookieVal (offset)
{
var endstr = okie
if (endstr ==
endstr = okie
return unescape(okie
}
function GetCookie (name)
{
var arg = name +
var alen = arg
var clen = okie
var i =
while (i < clen)
{
var j = i + alen;
if (okie
return getCookieVal (j);
i = okie
if (i ==
break;
}
return null;
}
function deleteCookie(cname) {
var expdate = new Date();
expdate
// okie =
setCookie(cname
function setCookie (name
okie = name +
}
一個可以在頁面上隨意畫線
var jg_ihtm
jg_n
function chkDHTM(x
{
x = document
jg_ie = x && typeof x
jg_dom = (x && !jg_ie &&
typeof x
typeof document
typeof (i = document
typeof i
jg_ihtm = !jg_ie && !jg_dom && x && typeof x
jg_fast = jg_ie && document
jg_moz = jg_dom && typeof x
}
function pntDoc()
{
this
=
}
function pntCnvDom()
{
var x = document
x
x = x
v
=
}
function pntCnvIe()
{
v
=
}
function pntCnvIhtm()
{
v
=
}
function pntCnv()
{
=
}
function mkDiv(x
{
+=
}
function mkDivIe(x
{
+=
}
function mkDivPrt(x
{
+=
}
function mkLyr(x
{
+=
}
var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function htmRpc()
{
return
regex
}
function htmPrtRpc()
{
return
regex
}
function mkLin(x
{
if (x
{
var _x
var _y
x
y
x
y
}
var dx = x
x = x
yIncr = (y
if (dx >= dy)
{
var pr = dy<<
pru = pr
p = pr
ox = x;
while ((dx
{
++x;
if (p >
{
this
y += yIncr;
p += pru;
ox = x;
}
else p += pr;
}
this
}
else
{
var pr = dx<<
pru = pr
p = pr
oy = y;
if (y
{
while ((dy
{
if (p >
{
this
y += yIncr;
p += pru;
oy = y;
}
else
{
y += yIncr;
p += pr;
}
}
this
}
else
{
while ((dy
{
y += yIncr;
if (p >
{
this
p += pru;
oy = y;
}
else p += pr;
}
this
}
}
}
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25371.html