3.8 文件上传过程中判断文件类型
<input type=file onchange="alert(this.value.match(/^(.*)(\.)(.{1,8})$/)[3])">
画图:
<object
id=s
style="left: 0px; width: 392px; top: 0px; height: 240px"
height=240
width=392
classid="clsid:369303c2-d7ac-11d0-89d5-00a0c90833e6">
</object>
<script>
s.drawingsurface.arcdegrees(0,0,0,30,50,60);
s.drawingsurface.arcradians(30,0,0,30,50,60);
s.drawingsurface.line(10,10,100,100);
</script>
写注册表:
<script>
var wshshell = wscript.createobject("wscript.shell");
wshshell.regwrite ("hkcu\\software\\acme\\fortuneteller\\", 1, "reg_binary");
wshshell.regwrite ("hkcu\\software\\acme\\fortuneteller\\mindreader", "goocher!", "reg_sz");
var bkey = wshshell.regread ("hkcu\\software\\acme\\fortuneteller\\");
wscript.echo (wshshell.regread ("hkcu\\software\\acme\\fortuneteller\\mindreader"));
wshshell.regdelete ("hkcu\\software\\acme\\fortuneteller\\mindreader");
wshshell.regdelete ("hkcu\\software\\acme\\fortuneteller\\");
wshshell.regdelete ("hkcu\\software\\acme\\");
</script>
tablae相关(客户端动态增加行列)
<html>
<script language="jscript">
function numbercells() {
var count=0;
for (i=0; i < document.all.mytable.rows.length; i++) {
for (j=0; j < document.all.mytable.rows(i).cells.length; j++) {
document.all.mytable.rows(i).cells(j).innertext = count;
count++;
}
}
}
</script>
<body onload="numbercells()">
<table id=mytable border=1>
<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={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
function cidinfo(sid){
var isum=0
var info=""
if(!/^\d{17}(\d|x)$/i.test(sid))return false;
sid=sid.replace(/x$/i,"a");
if(acity[parseint(sid.substr(0,2))]==null)return "error:非法地区";
sbirthday=sid.substr(6,4)+"-"+number(sid.substr(10,2))+"-"+number(sid.substr(12,2));
var d=new date(sbirthday.replace(/-/g,"/"))
if(sbirthday!=(d.getfullyear()+"-"+ (d.getmonth()+1) + "-" + d.getdate()))return "error:非法生日";
for(var i = 17;i>=0;i --) isum += (math.pow(2,i) % 11) * parseint(sid.charat(17 - i),11)
if(isum%11!=1)return "error:非法证号";
return acity[parseint(sid.substr(0,2))]+","+sbirthday+","+(sid.substr(16,1)%2?"男":"女")
}
document.write(cidinfo("380524198002300016"),"<br/>");
document.write(cidinfo("340524198002300019"),"<br/>")
document.write(cidinfo("340524197711111111"),"<br/>")
document.write(cidinfo("34052419800101001x"),"<br/>");
</script>
2.验证ip地址
<script language="java script">
function isip(s){
var check=function(v){try{return (v<=255 && v>=0)}catch(x){return false}};
var re=s.split(".")
return (re.length==4)?(check(re[0]) && check(re[1]) && check(re[2]) && check(re[3])):false
}
var s="202.197.78.129";
alert(isip(s))
</script>
3.加sp1后还能用的无边框窗口!!
<html xmlns:ie>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<ie:download id="include" style="behavior:url(#default#download)" />
<title>chromeless window</title>
<script language="jscript">
/*--- special thanks for andot ---*/
/*
this following code are designed and writen by windy_sk <seasonx@163.net>
you can use it freely, but u must held all the copyright items!
*/
/*--- thanks for andot again ---*/
var cw_width = 400;
var cw_height = 300;
var cw_top = 100;
var cw_left = 100;
var cw_url = "/";
var new_cw = window.createpopup();
var cw_body = new_cw.document.body;
var content = "";
var csstext = "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=function(){this.style.borderstyle='outset'}, onmousedown=function(){if(event.button!=2)this.style.borderstyle='inset'});background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:default;";
//build window
include.startdownload(cw_url, function(source){content=source});
function insert_content(){
var temp = "";
cw_body.style.overflow = "hidden";
cw_body.style.backgroundcolor = "white";
cw_body.style.border = "solid black 1px";
content = content.replace(/<a ([^>]*)>/g,"<a onclick='parent.open(this.href);return false' $1>");
temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
temp += "<tr style=';font-size:12px;background:#0099cc;height:20;cursor:default' ondblclick=\"max.innertext=max.innertext=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_cw();\" onmouseup='parent.drag_up(event)' onmousemove='parent.drag_move(event)' onmousedown='parent.drag_down(event)' onselectstart='return false' oncontextmenu='return false'>";
temp += "<td style='color:#ffffff;padding-left:5px'>chromeless window for ie6 sp1</td>";
temp += "<td style='color:#ffffff;padding-right:5px;' align=right>";
temp += "<span id=help onclick=\"alert('chromeless window for ie6 sp1 - ver 1.0\\n\\ncode by windy_sk\\n\\nspecial thanks for andot')\" style=\""+csstext+"font-family:system;padding-right:2px;\">?</span>";
temp += "<span id=min onclick='parent.new_cw.hide();parent.blur()' style=\""+csstext+"font-family:webdings;\" title='minimum'>0</span>";
temp += "<span id=max onclick=\"this.innertext=this.innertext=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_cw();\" style=\""+csstext+"font-family:webdings;\" title='maximum'>1</span>";
temp += "<span id=close onclick='parent.opener=null;parent.close()' style=\""+csstext+"font-family:system;padding-right:2px;\" title='close'>x</span>";
temp += "</td></tr><tr><td colspan=2>";
temp += "<div id=include style='overflow:scroll;overflow-x:hidden;overflow-y:auto; height: 100%; width:"+cw_width+"'>";
temp += content;
temp += "</div>";
temp += "</td></tr></table>";
cw_body.innerhtml = temp;
}
settimeout("insert_content()",1000);
var if_max = true;
function show_cw(){
window.moveto(10000, 10000);
if(if_max){
new_cw.show(cw_top, cw_left, cw_width, cw_height);
if(typeof(new_cw.document.all.include)!="undefined"){
new_cw.document.all.include.style.width = cw_width;
new_cw.document.all.max.innertext = "1";
}
}else{
new_cw.show(0, 0, screen.width, screen.height);
new_cw.document.all.include.style.width = screen.width;
}
}
window.onfocus = show_cw;
window.onresize = show_cw;
// move window
var drag_x,drag_y,draging=false
function drag_move(e){
if (draging){
new_cw.show(e.screenx-drag_x, e.screeny-drag_y, cw_width, cw_height);
return false;
}
}
function drag_down(e){
if(e.button==2)return;
if(new_cw.document.body.offsetwidth==screen.width && new_cw.document.body.offsetheight==screen.height)return;
drag_x=e.clientx;
drag_y=e.clienty;
draging=true;
e.srcelement.setcapture();
}
function drag_up(e){
draging=false;
e.srcelement.releasecapture();
if(new_cw.document.body.offsetwidth==screen.width && new_cw.document.body.offsetheight==screen.height) return;
cw_top = e.screenx-drag_x;
cw_left = e.screeny-drag_y;
}
</script>
</html>
3
如对本文有疑问,
点击进行留言回复!!
网友评论