linux社区爱心援助Linux认证系列教程业界动态站务新闻公司招聘网络学院网址大全LPI专题CISCO专题
设为首页
加入收藏
管理团队
JSP  
JAVA  
PERL  
 您的位置:首页 > 开发语言 > JavaScript >
栏目导栏
  php
  JSP
  ASP
  asp.net
  JAVA
  c/c++/c#
  perl
  JavaScript
  Basic
  Delphi
资料搜索
热门文章
·javascript 时间对象的格式化
·去掉字符串前后的空格
·javascript 事件监听机制
·javascript 事件调用顺序
·js刷新框架子页面的七种方法
·JavaScript:替换字符串
·IE下的JScript编程需注意的内存
·用javascript操作word文档
·Javascript中CTRL+回车提交表单
·JS 获取鼠标位置
·javascript判断Email地址是否有
·Javascript中Select的OnChange
·JS实现的滑动展开与折叠效果
·有分页功能的WEB打印
·Javascript实现窗口最大化的严
最新文章
·使用CSS改变表格边框样式
·为网页添加浮动广告
·判断表单中添加是否数字的JS与
·让浏览器状态栏动起来
·使用Javascript制作行间颜色间
·禁止用右键查看源代码
·网页侦测四法
·制作弹出公告窗口
·为网页添加特效
·网页中取消鼠标右键方法大全
·JavaScript 根据屏幕解析度显示
·如何实现浏览器上的右键菜单
·如何制作浮动广告
·让弹出窗口变得“体贴”一些
·JavaScript技巧:让网页自动穿上
Google
 
javascript 常用代码大全
[ 作者:  加入时间:2007-11-30 13:03:07  来自:Linux联盟收集整理 ]

//打开模式对话框 EtSLinux联盟
function doSelectUser(txtId) EtSLinux联盟
{

      strFeatures="dialogWidth=500px;dialogHeight=360px;center=yes;

middle=yes ;help=no;status=no;scroll=no"; EtSLinux联盟
      var url,strReturn; EtSLinux联盟
  EtSLinux联盟
      url="selUser.aspx"; EtSLinux联盟
        EtSLinux联盟
      strReturn=window.showModalDialog(url,'',strFeatures);  

}

//返回模式对话框的值 EtSLinux联盟
function okbtn_onclick() EtSLinux联盟
{ EtSLinux联盟
var commstr='';          EtSLinux联盟
      EtSLinux联盟
window.returnValue=commstr;

      window.close() ; EtSLinux联盟
} EtSLinux联盟
全屏幕打开 IE 窗口 EtSLinux联盟
var winWidth=screen.availWidth ; EtSLinux联盟
var winHeight=screen.availHeight-20; EtSLinux联盟
window.open("main.aspx","surveyWindow","toolbar=no,width="+ winWidth  +",height="+ winHeight  +",top=0,left=0,scrollbars=yes,resizable=yes,center:yes,statusbars=yes"); EtSLinux联盟
break EtSLinux联盟
//
脚本中中使用xml EtSLinux联盟
function initialize() { EtSLinux联盟
  var xmlDoc EtSLinux联盟
  var xslDoc

  xmlDoc = new ActiveXObject('Microsoft.XMLDOM') EtSLinux联盟
  xmlDoc.async = false;

  xslDoc = new ActiveXObject('Microsoft.XMLDOM') EtSLinux联盟
  xslDoc.async = false;

 xmlDoc.load("tree.xml") EtSLinux联盟
  xslDoc.load("tree.xsl") EtSLinux联盟
  EtSLinux联盟
  EtSLinux联盟
  folderTree.innerHTML = xmlDoc.documentElement.transformNode(xslDoc) EtSLinux联盟
}

一、验证类 EtSLinux联盟
1
、数字验证内 EtSLinux联盟
  1.1
整数 EtSLinux联盟
  1.2
大于0的整数 (用于传来的ID的验证) EtSLinux联盟
  1.3
负整数的验证 EtSLinux联盟
  1.4
整数不能大于iMax EtSLinux联盟
  1.5
整数不能小于iMin EtSLinux联盟
2
、时间类 EtSLinux联盟
  2.1
短时间,形如 (13:04:06) EtSLinux联盟
  2.2
短日期,形如 (2003-12-05) EtSLinux联盟
  2.3
长时间,形如 (2003-12-05 13:04:06) EtSLinux联盟
  2.4
只有年和月。形如(2003-05,或者2003-5) EtSLinux联盟
  2.5
只有小时和分钟,形如(12:03) EtSLinux联盟
3
、表单类 EtSLinux联盟
  3.1
所有的表单的值都不能为空 EtSLinux联盟
  3.2
多行文本框的值不能为空。 EtSLinux联盟
  3.3
多行文本框的值不能超过sMaxStrleng EtSLinux联盟
  3.4
多行文本框的值不能少于sMixStrleng EtSLinux联盟
  3.5
判断单选框是否选择。 EtSLinux联盟
  3.6
判断复选框是否选择. EtSLinux联盟
  3.7
复选框的全选,多选,全不选,反选 EtSLinux联盟
  3.8
文件上传过程中判断文件类型 EtSLinux联盟
4
、字符类 EtSLinux联盟
  4.1
判断字符全部由a-Z或者是A-Z的字字母组成 EtSLinux联盟
  4.2
判断字符由字母和数字组成。 EtSLinux联盟
  4.3
判断字符由字母和数字,下划线,点号组成.且开头的只能是下划线和字母 EtSLinux联盟
  4.4
字符串替换函数.Replace(); EtSLinux联盟
5
、浏览器类 EtSLinux联盟
  5.1
判断浏览器的类型 EtSLinux联盟
  5.2
判断ie的版本 EtSLinux联盟
  5.3
判断客户端的分辨率 EtSLinux联盟
  EtSLinux联盟
6
、结合类 EtSLinux联盟
  6.1 email
的判断。 EtSLinux联盟
  6.2
手机号码的验证 EtSLinux联盟
  6.3
身份证的验证 EtSLinux联盟
 

二、功能类 

1、时间与相关控件类 EtSLinux联盟
  1.1
日历 EtSLinux联盟
  1.2
时间控件 EtSLinux联盟
  1.3
万年历 EtSLinux联盟
  1.4
显示动态显示时钟效果(文本,如OA中时间) EtSLinux联盟
  1.5
显示动态显示时钟效果 (图像,像手表) EtSLinux联盟
2
、表单类 EtSLinux联盟
  2.1
自动生成表单 EtSLinux联盟
  2.2
动态添加,修改,删除下拉框中的元素 EtSLinux联盟
  2.3
可以输入内容的下拉框 EtSLinux联盟
  2.4
多行文本框中只能输入iMax文字。如果多输入了,自动减少到iMax个文字(多用于短信发送) EtSLinux联盟
  EtSLinux联盟
3
、打印类 EtSLinux联盟
  3.1
打印控件 EtSLinux联盟
4
、事件类 EtSLinux联盟
  4.1
屏蔽右键 EtSLinux联盟
  4.2
屏蔽所有功能键 EtSLinux联盟
  4.3 -->
<-- F5 F11,F9,F1 EtSLinux联盟
  4.4
屏蔽组合键ctrl+N EtSLinux联盟
5
网页设计 EtSLinux联盟
  5.1
连续滚动的文字,图片(注意是连续的,两段文字和图片中没有空白出现) EtSLinux联盟
  5.2 html
编辑控件类 EtSLinux联盟
  5.3
颜色选取框控件 EtSLinux联盟
  5.4
下拉菜单 EtSLinux联盟
  5.5
两层或多层次的下拉菜单 EtSLinux联盟
  5.6
仿IE菜单的按钮。(效果如rongshuxa.com的导航栏目) EtSLinux联盟
  5.7
状态栏,title栏的动态效果(例子很多,可以研究一下) EtSLinux联盟
  5.8
双击后,网页自动滚屏 EtSLinux联盟
6
、树型结构。 EtSLinux联盟
  6.1 asp+SQL
EtSLinux联盟
  6.2 asp+xml+sql
EtSLinux联盟
  6.3 java+sql
或者java+sql+xml EtSLinux联盟
7
、无边框效果的制作 EtSLinux联盟
8
、连动下拉框技术 EtSLinux联盟
9
、文本排序 EtSLinux联盟
10
,画图类,含饼、柱、矢量贝滋曲线 EtSLinux联盟
11
,操纵客户端注册表类 EtSLinux联盟
12
DIV层相关(拖拽、显示、隐藏、移动、增加) EtSLinux联盟
13
TABLAE相关(客户端动态增加行列,模拟进度条,滚动列表等) EtSLinux联盟
14
,各种<object classid=>相关类,如播放器,flash与脚本互动等 EtSLinux联盟
16,
刷新/模拟无刷新 异步调用类(XMLHttpiframe,frame 

EtSLinux联盟
一、验证类 EtSLinux联盟
1
、数字验证内 EtSLinux联盟
  1.1
整数 EtSLinux联盟
      /^(-|\+)?\d+$/.test(str) EtSLinux联盟
  1.2
大于0的整数 (用于传来的ID的验证) EtSLinux联盟
      /^\d+$/.test(str) EtSLinux联盟
  1.3
负整数的验证 EtSLinux联盟
      /^-\d+$/.test(str) EtSLinux联盟
2
、时间类 EtSLinux联盟
  2.1
短时间,形如 (13:04:06) EtSLinux联盟
      function isTime(str) EtSLinux联盟
      { EtSLinux联盟
        var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/); EtSLinux联盟
        if (a == null) {alert('
输入的参数不是时间格式'); return false;} EtSLinux联盟
        if (a[1]>24 || a[3]>60 || a[4]>60) EtSLinux联盟
        { EtSLinux联盟
          alert("
时间格式不对"); EtSLinux联盟
          return false EtSLinux联盟
        } EtSLinux联盟
        return true; EtSLinux联盟
      } EtSLinux联盟
  2.2
短日期,形如 (2003-12-05) EtSLinux联盟
      function strDateTime(str) EtSLinux联盟
      { EtSLinux联盟
         var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); EtSLinux联盟
         if(r==null)return false; EtSLinux联盟
         var d= new Date(r[1], r[3]-1, r[4]); EtSLinux联盟
         return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]); EtSLinux联盟
      } EtSLinux联盟
  2.3
长时间,形如 (2003-12-05 13:04:06) EtSLinux联盟
      function strDateTime(str) EtSLinux联盟
      { EtSLinux联盟
        var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; EtSLinux联盟
        var r = str.match(reg); EtSLinux联盟
        if(r==null)return false; EtSLinux联盟
        var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]); EtSLinux联盟
        return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]); EtSLinux联盟
      } EtSLinux联盟
  2.4
只有年和月。形如(2003-05,或者2003-5) EtSLinux联盟
  2.5
只有小时和分钟,形如(12:03) EtSLinux联盟
3
、表单类 EtSLinux联盟
  3.1
所有的表单的值都不能为空 EtSLinux联盟
      <input onblur="if(this.value.replace(/^\s+|\s+$/g,'')=='')alert('
不能为空!')"> EtSLinux联盟
  3.2
多行文本框的值不能为空。 EtSLinux联盟
  3.3
多行文本框的值不能超过sMaxStrleng EtSLinux联盟
  3.4
多行文本框的值不能少于sMixStrleng EtSLinux联盟
  3.5
判断单选框是否选择。 EtSLinux联盟
  3.6
判断复选框是否选择. EtSLinux联盟
  3.7
复选框的全选,多选,全不选,反选 EtSLinux联盟
  3.8
文件上传过程中判断文件类型 EtSLinux联盟
4
、字符类 EtSLinux联盟
  4.1
判断字符全部由a-Z或者是A-Z的字字母组成 EtSLinux联盟
      <input onblur="if(/[^a-zA-Z]/g.test(this.value))alert('
有错')"> EtSLinux联盟
  4.2
判断字符由字母和数字组成。 EtSLinux联盟
      <input onblur="if(/[^0-9a-zA-Z]/g.test(this.value))alert('
有错')"> EtSLinux联盟
  4.3
判断字符由字母和数字,下划线,点号组成.且开头的只能是下划线和字母 EtSLinux联盟
      /^([a-zA-z_]{1})([\w]*)$/g.test(str) EtSLinux联盟
  4.4
字符串替换函数.Replace(); EtSLinux联盟
5
、浏览器类 EtSLinux联盟
  5.1
判断浏览器的类型 EtSLinux联盟
      window.navigator.appName EtSLinux联盟
  5.2
判断ie的版本 EtSLinux联盟
      window.navigator.appVersion EtSLinux联盟
  5.3
判断客户端的分辨率 EtSLinux联盟
      window.screen.height;  window.screen.width; EtSLinux联盟
  EtSLinux联盟
6
、结合类 EtSLinux联盟
  6.1 email
的判断。 EtSLinux联盟
      function ismail(mail) EtSLinux联盟
      { EtSLinux联盟
        return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(mail)); EtSLinux联盟
      } EtSLinux联盟
  6.2
手机号码的验证 EtSLinux联盟
  6.3
身份证的验证 EtSLinux联盟
      function isIdCardNo(num) EtSLinux联盟
      { EtSLinux联盟
        if (isNaN(num)) {alert("
输入的不是数字!"); return false;} EtSLinux联盟
        var len = num.length, re; EtSLinux联盟
        if (len == 15) EtSLinux联盟
          re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/); EtSLinux联盟
        else if (len == 18) EtSLinux联盟
          re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/); EtSLinux联盟
        else {alert("
输入的数字位数不对!"); return false;} EtSLinux联盟
        var a = num.match(re); EtSLinux联盟
        if (a != null) EtSLinux联盟
        { EtSLinux联盟
          if (len==15) EtSLinux联盟
          { EtSLinux联盟
            var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]); EtSLinux联盟
            var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; EtSLinux联盟
          } EtSLinux联盟
          else EtSLinux联盟
          { EtSLinux联盟
            var D = new Date(a[3]+"/"+a[4]+"/"+a[5]); EtSLinux联盟
            var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; EtSLinux联盟
          } EtSLinux联盟
          if (!B) {alert("
输入的身份证号 "+ a[0] +" 里出生日期不对!"); return false;} EtSLinux联盟
        } EtSLinux联盟
        return true; EtSLinux联盟
      }

画图: EtSLinux联盟
<OBJECT EtSLinux联盟
id=S EtSLinux联盟
style="LEFT: 0px; WIDTH: 392px; TOP: 0px; HEIGHT: 240px" EtSLinux联盟
height=240 EtSLinux联盟
width=392 EtSLinux联盟
classid="clsid:369303C2-D7AC-11D0-89D5-00A0C90833E6"> EtSLinux联盟
</OBJECT> EtSLinux联盟
<SCRIPT> EtSLinux联盟
S.DrawingSurface.ArcDegrees(0,0,0,30,50,60); EtSLinux联盟
S.DrawingSurface.ArcRadians(30,0,0,30,50,60); EtSLinux联盟
S.DrawingSurface.Line(10,10,100,100); EtSLinux联盟
</SCRIPT> EtSLinux联盟
EtSLinux联盟
写注册表: EtSLinux联盟
<SCRIPT> EtSLinux联盟
var WshShell = WScript.CreateObject("WScript.Shell"); EtSLinux联盟
WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\", 1, "REG_BINARY"); EtSLinux联盟
WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader", "Goocher!", "REG_SZ"); EtSLinux联盟
var bKey =    WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\"); EtSLinux联盟
WScript.Echo (WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader")); EtSLinux联盟
WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader"); EtSLinux联盟
WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\"); EtSLinux联盟
WshShell.RegDelete ("HKCU\\Software\\ACME\\"); EtSLinux联盟
</SCRIPT>

TABLAE相关(客户端动态增加行列) EtSLinux联盟
<HTML> EtSLinux联盟
<SCRIPT LANGUAGE="JScript"> EtSLinux联盟
function numberCells() { EtSLinux联盟
    var count=0; EtSLinux联盟
    for (i=0; i < document.all.mytable.rows.length; i++) { EtSLinux联盟
        for (j=0; j < document.all.mytable.rows(i).cells.length; j++) { EtSLinux联盟
            document.all.mytable.rows(i).cells(j).innerText = count; EtSLinux联盟
            count++; EtSLinux联盟
        } EtSLinux联盟
    } EtSLinux联盟
} EtSLinux联盟
</SCRIPT> EtSLinux联盟
<BODY onload="numberCells()"> EtSLinux联盟
<TABLE id=mytable border=1> EtSLinux联盟
<TR><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH></TR> EtSLinux联盟
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR> EtSLinux联盟
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR> EtSLinux联盟
</TABLE> EtSLinux联盟
</BODY> EtSLinux联盟
</HTML>

1.身份证严格验证: 

<script> EtSLinux联盟
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:"国外"} EtSLinux联盟
  EtSLinux联盟
function cidInfo(sId){ EtSLinux联盟
var iSum=0 EtSLinux联盟
var info="" EtSLinux联盟
if(!/^\d{17}(\d|x)$/i.test(sId))return false; EtSLinux联盟
sId=sId.replace(/x$/i,"a"); EtSLinux联盟
if(aCity[parseInt(sId.substr(0,2))]==null)return "Error:
非法地区"; EtSLinux联盟
sBirthday=sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-"+Number(sId.substr(12,2)); EtSLinux联盟
var d=new Date(sBirthday.replace(/-/g,"/")) EtSLinux联盟
if(sBirthday!=(d.getFullYear()+"-"+ (d.getMonth()+1) + "-" + d.getDate()))return "Error:
非法生日"; EtSLinux联盟
for(var i = 17;i>=0;i --) iSum += (Math.pow(2,i) % 11) * parseInt(sId.charAt(17 - i),11) EtSLinux联盟
if(iSum%11!=1)return "Error:
非法证号"; EtSLinux联盟
return aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"
":"") EtSLinux联盟
}

document.write(cidInfo("380524198002300016"),"<br/>"); EtSLinux联盟
document.write(cidInfo("340524198002300019"),"<br/>") EtSLinux联盟
document.write(cidInfo("340524197711111111"),"<br/>") EtSLinux联盟
document.write(cidInfo("34052419800101001x"),"<br/>"); EtSLinux联盟
</script>

2.验证IP地址 EtSLinux联盟
<SCRIPT LANGUAGE="JavaScript"> EtSLinux联盟
function isip(s){ EtSLinux联盟
var check=function(v){try{return (v<=255 && v>=0)}catch(x){return false}}; EtSLinux联盟
var re=s.split(".") EtSLinux联盟
return (re.length==4)?(check(re[0]) && check(re[1]) && check(re[2]) && check(re[3])):false EtSLinux联盟
}

var s="202.197.78.129"; EtSLinux联盟
alert(isip(s)) EtSLinux联盟
</SCRIPT>

3.加sp1后还能用的无边框窗口!! EtSLinux联盟
<HTML XMLNS:IE> EtSLinux联盟
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> EtSLinux联盟
<IE:Download ID="include" STYLE="behavior:url(#default#download)" /> EtSLinux联盟
<title>Chromeless Window</title>

<SCRIPT LANGUAGE="JScript"> EtSLinux联盟
/*--- Special Thanks For andot ---*/

/* EtSLinux联盟
 This following code are designed and writen by Windy_sk <seasonx@163.net> EtSLinux联盟
 You can use it freely, but u must held all the copyright items! EtSLinux联盟
*/

/*--- Thanks For andot Again ---*/

var CW_width= 400; EtSLinux联盟
var CW_height= 300; EtSLinux联盟
var CW_top= 100; EtSLinux联盟
var CW_left= 100; EtSLinux联盟
var CW_url= "/"; EtSLinux联盟
var New_CW= window.createPopup(); EtSLinux联盟
var CW_Body= New_CW.document.body; EtSLinux联盟
var content= ""; EtSLinux联盟
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 EtSLinux联盟
include.startDownload(CW_url, function(source){content=source});

function insert_content(){ EtSLinux联盟
var temp = ""; EtSLinux联盟
CW_Body.style.overflow= "hidden"; EtSLinux联盟
CW_Body.style.backgroundColor= "white"; EtSLinux联盟
CW_Body.style.border=  "solid black 1px"; EtSLinux联盟
content = content.replace(/<a ([^>]*)>/g,"<a onclick='parent.open(this.href);return false' $1>"); EtSLinux联盟
temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>"; EtSLinux联盟
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'>"; EtSLinux联盟
temp += "<td style='color:#ffffff;padding-left:5px'>Chromeless Window For IE6 SP1</td>"; EtSLinux联盟
temp += "<td style='color:#ffffff;padding-right:5px;' align=right>"; EtSLinux联盟
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>"; EtSLinux联盟
temp += "<span id=Min   onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\" title='Minimum'>0</span>"; EtSLinux联盟
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>"; EtSLinux联盟
temp += "<span id=Close onclick='parent.opener=null;parent.close()' style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>"; EtSLinux联盟
temp += "</td></tr><tr><td colspan=2>"; EtSLinux联盟
temp += "<div id=include style='overflow:scroll;overflow-x:hidden;overflow-y:auto; HEIGHT: 100%; width:"+CW_width+"'>"; EtSLinux联盟
temp += content; EtSLinux联盟
temp += "</div>"; EtSLinux联盟
temp += "</td></tr></table>"; EtSLinux联盟
CW_Body.innerHTML = temp; EtSLinux联盟
}

setTimeout("insert_content()",1000);

var if_max = true; EtSLinux联盟
function show_CW(){ EtSLinux联盟
window.moveTo(10000, 10000); EtSLinux联盟
if(if_max){ EtSLinux联盟
New_CW.show(CW_top, CW_left, CW_width, CW_height); EtSLinux联盟
if(typeof(New_CW.document.all.include)!="undefined"){ EtSLinux联盟
New_CW.document.all.include.style.width = CW_width; EtSLinux联盟
New_CW.document.all.Max.innerText = "1"; EtSLinux联盟
}

}else{ EtSLinux联盟
New_CW.show(0, 0, screen.width, screen.height); EtSLinux联盟
New_CW.document.all.include.style.width = screen.width; EtSLinux联盟
} EtSLinux联盟
}

window.onfocus  = show_CW; EtSLinux联盟
window.onresize = show_CW;

// Move Window EtSLinux联盟
var drag_x,drag_y,draging=false

function drag_move(e){ EtSLinux联盟
if (draging){ EtSLinux联盟
New_CW.show(e.screenX-drag_x, e.screenY-drag_y, CW_width, CW_height); EtSLinux联盟
return false; EtSLinux联盟
} EtSLinux联盟
}

function drag_down(e){ EtSLinux联盟
if(e.button==2)return; EtSLinux联盟
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)return; EtSLinux联盟
drag_x=e.clientX; EtSLinux联盟
drag_y=e.clientY; EtSLinux联盟
draging=true; EtSLinux联盟
e.srcElement.setCapture(); EtSLinux联盟
}

function drag_up(e){ EtSLinux联盟
draging=false; EtSLinux联盟
e.srcElement.releaseCapture(); EtSLinux联盟
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return; EtSLinux联盟
CW_top  = e.screenX-drag_x; EtSLinux联盟
CW_left = e.screenY-drag_y; EtSLinux联盟
}

</SCRIPT> EtSLinux联盟
</HTML>

EtSLinux联盟
EtSLinux联盟
贴两个关于treeview EtSLinux联盟
  <script language="javascript"> EtSLinux联盟
<!-- EtSLinux联盟
//
初始化选中节点 EtSLinux联盟
function initchecknode() EtSLinux联盟
{ EtSLinux联盟
 var node=TreeView1.getTreeNode("1"); EtSLinux联盟
 node.setAttribute("Checked","true"); EtSLinux联盟
 setcheck(node,"true"); EtSLinux联盟
 FindCheckedFromNode(TreeView1); EtSLinux联盟
} EtSLinux联盟
//oncheck
事件 EtSLinux联盟
function tree_oncheck(tree) EtSLinux联盟
{ EtSLinux联盟
 var node=tree.getTreeNode(tree.clickedNodeIndex); EtSLinux联盟
 var Pchecked=tree.getTreeNode(tree.clickedNodeIndex).getAttribute("checked"); EtSLinux联盟
 setcheck(node,Pchecked); EtSLinux联盟
 document.all.checked.value=""; EtSLinux联盟
 document.all.unchecked.value=""; EtSLinux联盟
 FindCheckedFromNode(TreeView1); EtSLinux联盟
} EtSLinux联盟
//
设置子节点选中 EtSLinux联盟
function setcheck(node,Pc) EtSLinux联盟
{ EtSLinux联盟
 var i; EtSLinux联盟
 var ChildNode=new Array(); EtSLinux联盟
 ChildNode=node.getChildren(); EtSLinux联盟
  EtSLinux联盟
 if(parseInt(ChildNode.length)==0) EtSLinux联盟
  return; EtSLinux联盟
 else EtSLinux联盟
 { EtSLinux联盟
  for(i=0;i<ChildNode.length;i++) EtSLinux联盟
  { EtSLinux联盟
   var cNode; EtSLinux联盟
   cNode=ChildNode[i]; EtSLinux联盟
   if(parseInt(cNode.getChildren().length)!=0) EtSLinux联盟
    setcheck(cNode,Pc); EtSLinux联盟
   cNode.setAttribute("Checked",Pc); EtSLinux联盟
  } EtSLinux联盟
 } EtSLinux联盟
} EtSLinux联盟
//
获取所有节点状态 EtSLinux联盟
function FindCheckedFromNode(node) { EtSLinux联盟
 var i = 0; EtSLinux联盟
 var nodes = new Array(); EtSLinux联盟
 nodes = node.getChildren(); EtSLinux联盟
  EtSLinux联盟
 for (i = 0; i < nodes.length; i++) { EtSLinux联盟
  var cNode; EtSLinux联盟
  cNode=nodes[i]; EtSLinux联盟
  if (cNode.getAttribute("Checked")) EtSLinux联盟
   AddChecked(cNode); EtSLinux联盟
  else EtSLinux联盟
      AddUnChecked(cNode); EtSLinux联盟
  EtSLinux联盟
  if (parseInt(cNode.getChildren().length) != 0 ) { EtSLinux联盟
   FindCheckedFromNode(cNode); EtSLinux联盟
  } EtSLinux联盟
 } EtSLinux联盟
} EtSLinux联盟
//
添加选中节点 EtSLinux联盟
function AddChecked(node) { EtSLinux联盟
 document.all.checked.value += node.getAttribute("NodeData"); EtSLinux联盟
 document.all.checked.value += ','; EtSLinux联盟
} EtSLinux联盟
//
添加未选中节点 EtSLinux联盟
function AddUnChecked(node) { EtSLinux联盟
 document.all.unchecked.value += node.getAttribute("NodeData"); EtSLinux联盟
 document.all.unchecked.value += ','; EtSLinux联盟
} EtSLinux联盟
//--> EtSLinux联盟
  </script>

EtSLinux联盟
EtSLinux联盟
treeview
中如何在服务器端得到客户端设置后的节点选中状态 EtSLinux联盟
 <script language="C#" runat="server"> EtSLinux联盟
   private void Button1_Click(object sender, System.EventArgs e) EtSLinux联盟
   { EtSLinux联盟
    Response.Write(TreeView1.Nodes[0].Checked); EtSLinux联盟
   } EtSLinux联盟
  </script> EtSLinux联盟
  <script language="javascript"> EtSLinux联盟
   function set_check() EtSLinux联盟
   { EtSLinux联盟
    var nodeindex = "0"; EtSLinux联盟
    var node=TreeView1.getTreeNode(nodeindex); EtSLinux联盟
    node.setAttribute("Checked","True"); EtSLinux联盟
    TreeView1.queueEvent('oncheck', nodeindex); EtSLinux联盟
   } EtSLinux联盟
  </script>

EtSLinux联盟
EtSLinux联盟
三個實用的小技巧:關閉輸入法.禁止貼上.禁止複製 EtSLinux联盟
關閉輸入法 

本文字框輸入法被關閉:  EtSLinux联盟
語法: style="ime-mode:disabled" EtSLinux联盟
範例: <input type="text" name="textfield" style="ime-mode:disabled">

禁止貼上 

本文字框禁止貼上文字:  EtSLinux联盟
語法:onpaste="return false" EtSLinux联盟
範例:<input type="text" name="textfield" onpaste="return false">

禁止複製 

本文字框禁止複製:  EtSLinux联盟
語法:oncopy="return false;" oncut="return false;" EtSLinux联盟
範例:<input name="textfield" type="text" value="不能複製裡面的字" oncopy="return false;" oncut="return false;">

EtSLinux联盟
EtSLinux联盟
//================================ EtSLinux联盟
//Cookie
操作 EtSLinux联盟
//================================ EtSLinux联盟
function getCookieVal (offset) EtSLinux联盟
{ EtSLinux联盟
var endstr = document.cookie.indexOf (";", offset); EtSLinux联盟
if (endstr == -1) EtSLinux联盟
endstr = document.cookie.length; EtSLinux联盟
return unescape(document.cookie.substring(offset, endstr)); EtSLinux联盟
}

function GetCookie (name) EtSLinux联盟
{ EtSLinux联盟
var arg = name + "="; EtSLinux联盟
var alen = arg.length; EtSLinux联盟
var clen = document.cookie.length; EtSLinux联盟
var i = 0; EtSLinux联盟
while (i < clen) EtSLinux联盟
{ EtSLinux联盟
var j = i + alen; EtSLinux联盟
if (document.cookie.substring(i, j) == arg) EtSLinux联盟
return getCookieVal (j); EtSLinux联盟
i = document.cookie.indexOf(" ", i) + 1; EtSLinux联盟
if (i == 0) EtSLinux联盟
break; EtSLinux联盟
} EtSLinux联盟
return null; EtSLinux联盟
}

EtSLinux联盟
function deleteCookie(cname) {

  var expdate = new Date(); EtSLinux联盟
  expdate.setTime(expdate.getTime() - (24 * 60 * 60 * 1000 * 369));

 // document.cookie =" ckValue="ok"; expires="+ expdate.toGMTString(); EtSLinux联盟
  setCookie(cname,"",expdate);

}

function setCookie (name, value, expires) {

  document.cookie = name + "=" + escape(value) + EtSLinux联盟
    "; expires=" + expires.toGMTString() ; EtSLinux联盟
}

EtSLinux联盟
EtSLinux联盟
一个可以在页面上随意画线、多边形、圆,填充等功能的js  part 1 

var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz, EtSLinux联盟
jg_n4 = (document.layers && typeof document.classes != "undefined");

EtSLinux联盟
function chkDHTM(x, i) EtSLinux联盟
{ EtSLinux联盟
x = document.body || null; EtSLinux联盟
jg_ie = x && typeof x.insertAdjacentHTML != "undefined"; EtSLinux联盟
jg_dom = (x && !jg_ie && EtSLinux联盟
typeof x.appendChild != "undefined" && EtSLinux联盟
typeof document.createRange != "undefined" && EtSLinux联盟
typeof (i = document.createRange()).setStartBefore != "undefined" && EtSLinux联盟
typeof i.createContextualFragment != "undefined"); EtSLinux联盟
jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined"; EtSLinux联盟
jg_fast = jg_ie && document.all && !window.opera; EtSLinux联盟
jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined"; EtSLinux联盟
}

EtSLinux联盟
function pntDoc() EtSLinux联盟
{ EtSLinux联盟
this.wnd.document.write(jg_fast? this.htmRpc() : this.htm); EtSLinux联盟
this.htm = ''; EtSLinux联盟
}

EtSLinux联盟
function pntCnvDom() EtSLinux联盟
{ EtSLinux联盟
var x = document.createRange(); EtSLinux联盟
x.setStartBefore(this.cnv); EtSLinux联盟
x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm); EtSLinux联盟
this.cnv.appendChild(x); EtSLinux联盟
this.htm = ''; EtSLinux联盟
}

EtSLinux联盟
function pntCnvIe() EtSLinux联盟
{ EtSLinux联盟
this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm); EtSLinux联盟
this.htm = ''; EtSLinux联盟
}

EtSLinux联盟
function pntCnvIhtm() EtSLinux联盟
{ EtSLinux联盟
this.cnv.innerHTML += this.htm; EtSLinux联盟
this.htm = ''; EtSLinux联盟
}

EtSLinux联盟
function pntCnv() EtSLinux联盟
{ EtSLinux联盟
this.htm = ''; EtSLinux联盟
}

EtSLinux联盟
function mkDiv(x, y, w, h) EtSLinux联盟
{ EtSLinux联盟
this.htm += '<div style="position:absolute;'+ EtSLinux联盟
'left:' + x + 'px;'+ EtSLinux联盟
'top:' + y + 'px;'+ EtSLinux联盟
'width:' + w + 'px;'+ EtSLinux联盟
'height:' + h + 'px;'+ EtSLinux联盟
'clip:rect(0,'+w+'px,'+h+'px,0);'+ EtSLinux联盟
'background-color:' + this.color + EtSLinux联盟
(!jg_moz? ';overflow:hidden' : '')+ EtSLinux联盟
';"><\/div>'; EtSLinux联盟
}

EtSLinux联盟
function mkDivIe(x, y, w, h) EtSLinux联盟
{ EtSLinux联盟
this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';'; EtSLinux联盟
}

EtSLinux联盟
function mkDivPrt(x, y, w, h) EtSLinux联盟
{ EtSLinux联盟
this.htm += '<div style="position:absolute;'+ EtSLinux联盟
'border-left:' + w + 'px solid ' + this.color + ';'+ EtSLinux联盟
'left:' + x + 'px;'+ EtSLinux联盟
'top:' + y + 'px;'+ EtSLinux联盟
'width:0px;'+ EtSLinux联盟
'height:' + h + 'px;'+ EtSLinux联盟
'clip:rect(0,'+w+'px,'+h+'px,0);'+ EtSLinux联盟
'background-color:' + this.color + EtSLinux联盟
(!jg_moz? ';overflow:hidden' : '')+ EtSLinux联盟
';"><\/div>'; EtSLinux联盟
}

EtSLinux联盟
function mkLyr(x, y, w, h) EtSLinux联盟
{ EtSLinux联盟
this.htm += '<layer '+ EtSLinux联盟
'left="' + x + '" '+ EtSLinux联盟
'top="' + y + '" '+ EtSLinux联盟
'width="' + w + '" '+ EtSLinux联盟
'height="' + h + '" '+ EtSLinux联盟
'bgcolor="' + this.color + '"><\/layer>\n'; EtSLinux联盟
}

EtSLinux联盟
var regex =  /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g; EtSLinux联盟
function htmRpc() EtSLinux联盟
{ EtSLinux联盟
return this.htm.replace( EtSLinux联盟
regex, EtSLinux联盟
'<div style="overflow:hidden;position:absolute;background-color:'+ EtSLinux联盟
'$1;left:$2;top:$3;width:$4;height:$5"></div>\n'); EtSLinux联盟
}

EtSLinux联盟
function htmPrtRpc() EtSLinux联盟
{ EtSLinux联盟
return this.htm.replace( EtSLinux联盟
regex, EtSLinux联盟
'<div style="overflow:hidden;position:absolute;background-color:'+ EtSLinux联盟
'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n'); EtSLinux联盟
}

EtSLinux联盟
function mkLin(x1, y1, x2, y2) EtSLinux联盟
{ EtSLinux联盟
if (x1 > x2) EtSLinux联盟
{ EtSLinux联盟
var _x2 = x2; EtSLinux联盟
var _y2 = y2; EtSLinux联盟
x2 = x1; EtSLinux联盟
y2 = y1; EtSLinux联盟
x1 = _x2; EtSLinux联盟
y1 = _y2; EtSLinux联盟
} EtSLinux联盟
var dx = x2-x1, dy = Math.abs(y2-y1), EtSLinux联盟
x = x1, y = y1, EtSLinux联盟
yIncr = (y1 > y2)? -1 : 1;

if (dx >= dy) EtSLinux联盟
{ EtSLinux联盟
var pr = dy<<1, EtSLinux联盟
pru = pr - (dx<<1), EtSLinux联盟
p = pr-dx, EtSLinux联盟
ox = x; EtSLinux联盟
while ((dx--) > 0) EtSLinux联盟
{ EtSLinux联盟
++x; EtSLinux联盟
if (p > 0) EtSLinux联盟
{ EtSLinux联盟
this.mkDiv(ox, y, x-ox, 1); EtSLinux联盟
y += yIncr; EtSLinux联盟
p += pru; EtSLinux联盟
ox = x; EtSLinux联盟
} EtSLinux联盟
else p += pr; EtSLinux联盟
} EtSLinux联盟
this.mkDiv(ox, y, x2-ox+1, 1); EtSLinux联盟
}