WEB开发网
开发学院网页设计JavaScript 汇总Javascript各种判断脚本(javascript经典例子)... 阅读

汇总Javascript各种判断脚本(javascript经典例子)

 2010-09-14 13:16:07 来源:WEB开发网   
核心提示: -3.7 复选框的全选,多选,汇总Javascript各种判断脚本(javascript经典例子)(5),全不选,反选全选全选function checkAll(str){var a = document.getElementsByName(str);var n = a.length;fo

-------------------------------------------------------------------------------------

3.7 复选框的全选,多选,全不选,反选

全选

全选

function checkAll(str)
{
var a = document.getElementsByName(str);
var n = a.length;
for (var i=0; ia[i].checked = window.event.srcElement.checked;
}
function checkItem(str)
{
var e = window.event.srcElement;
var all = eval("document.hrong."+ str);
if (e.checked)
{
var a = document.getElementsByName(e.name);
all.checked = true;
for (var i=0; i{
if (!a[i].checked){ all.checked = false; break;}
}
}
else all.checked = false;
}

3.8 文件上传过程中判断文件类型

-------------------------------------------------------------------------------------

1.身份证严格验证:

2.验证IP地址

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))

3.加sp1后还能用的无边框窗口!!

/*--- Special Thanks For andot ---*/
/*
This following code are designed and writen by Windy_sk
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(/]*)>/g,"");
temp += "";
temp += "";
temp += "Chromeless Window For IE6 SP1";
temp += "";
temp += "?";
temp += "0";
temp += "1";
temp += "x";
temp += "";
temp += "";
temp += content;
temp += "
";
temp += "";
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)!="#ff0000"){
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;
}

上一页  1 2 3 4 5 6 7 8 9 10  下一页

Tags:汇总 Javascript 各种

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接