狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

javascript 常用代碼大全(超級收藏,強烈推薦)(3)

admin
2010年4月26日 23:18 本文熱度 7818
[p]打開模式對話框 [br]返回模式對話框的值 [br]全屏幕打開 ie 窗口[br]腳本中中使用xml [br]一、驗證類 [br]1、數字驗證內[br]2、時間類[br]3、表單類[br]4、字符類[br]5、瀏覽器類[br]6、結合類[/p]
[p][align=left]二、功能類 [br]1、時間與相關控件類[br]2、表單類 [br]3、打印類 [br]4、事件類 [br]5、網頁設計類[br]6、樹型結構。[br]7、無邊框效果的制作 [br]8、連動下拉框技術 [br]9、文本排序 [br]10,畫圖類,含餅、柱、矢量貝滋曲線 [br]11,操縱客戶端注冊表類 [br]12,div層相關(拖拽、顯示、隱藏、移動、增加) [br]13,tablae相關(客戶端動態增加行列,模擬進度條,滾動列表等) [br]14,各種object classid=>相關類,如播放器,flash與腳本互動等 [br]16, 刷新/模擬無刷新 異步調用類(xmlhttp或iframe,frame) [/align][/p]
[br]針對javascript的幾個對象的擴充函數 [br]function checkbrowser() [br]{ [br]this.ver=navigator.appversion [br]this.dom=document.getelementbyid?1:0 [br]this.ie6=(this.ver.indexof("msie 6")>-1 && this.dom)?1:0; [br]this.ie5=(this.ver.indexof("msie 5")>-1 && this.dom)?1:0; [br]this.ie4=(document.all && !this.dom)?1:0; [br]this.ns5=(this.dom && parseint(this.ver) >= 5) ?1:0; [br]this.ns4=(document.layers && !this.dom)?1:0; [br]this.mac=(this.ver.indexof('mac') > -1) ?1:0; [br]this.ope=(navigator.useragent.indexof('opera')>-1); [br]this.ie=(this.ie6 || this.ie5 || this.ie4) [br]this.ns=(this.ns4 || this.ns5) [br]this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope) [br]this.nbw=(!this.bw)
return this; [br]} [br]/* [br]****************************************** [br]日期函數擴充 [br]****************************************** [br]*/
[br]/* [br]=========================================== [br]//轉換成大寫日期(中文) [br]=========================================== [br]*/ [br]date.prototype.tocase = function() [br]{ [br]var digits= new array('零','一','二','三','四','五','六','七','八','九','十','十一','十二'); [br]var unit= new array('年','月','日','點','分','秒');
var year= this.getyear() + ""; [br]var index; [br]var output="";
////////得到年 [br]for (index=0;index ///////得到月 [br]output +=digits[this.getmonth()] + unit[1];
///////得到日 [br]switch (parseint(this.getdate() / 10)) [br]{ [br]case 0: [br]output +=digits[this.getdate() % 10]; [br]break; [br]case 1: [br]output +=digits[10] + ((this.getdate() % 10)>0?digits[(this.getdate() % 10)]:""); [br]break; [br]case 2: [br]case 3: [br]output +=digits[parseint(this.getdate() / 10)] + digits[10] + ((this.getdate() % 10)>0?digits[(this.getdate() % 10)]:""); [br]default:
break; [br]} [br]output +=unit[2];
///////得到時 [br]switch (parseint(this.gethours() / 10)) [br]{ [br]case 0: [br]output +=digits[this.gethours() % 10]; [br]break; [br]case 1: [br]output +=digits[10] + ((this.gethours() % 10)>0?digits[(this.gethours() % 10)]:""); [br]break; [br]case 2: [br]output +=digits[parseint(this.gethours() / 10)] + digits[10] + ((this.gethours() % 10)>0?digits[(this.gethours() % 10)]:""); [br]break; [br]} [br]output +=unit[3];
if(this.getminutes()==0&&this.getseconds()==0) [br]{ [br]output +="整"; [br]return output; [br]}
///////得到分 [br]switch (parseint(this.getminutes() / 10)) [br]{ [br]case 0: [br]output +=digits[this.getminutes() % 10]; [br]break; [br]case 1: [br]output +=digits[10] + ((this.getminutes() % 10)>0?digits[(this.getminutes() % 10)]:""); [br]break; [br]case 2: [br]case 3: [br]case 4: [br]case 5: [br]output +=digits[parseint(this.getminutes() / 10)] + digits[10] + ((this.getminutes() % 10)>0?digits[(this.getminutes() % 10)]:""); [br]break; [br]} [br]output +=unit[4];
if(this.getseconds()==0) [br]{ [br]output +="整"; [br]return output; [br]}
///////得到秒 [br]switch (parseint(this.getseconds() / 10)) [br]{ [br]case 0: [br]output +=digits[this.getseconds() % 10]; [br]break; [br]case 1: [br]output +=digits[10] + ((this.getseconds() % 10)>0?digits[(this.getseconds() % 10)]:""); [br]break; [br]case 2: [br]case 3: [br]case 4: [br]case 5: [br]output +=digits[parseint(this.getseconds() / 10)] + digits[10] + ((this.getseconds() % 10)>0?digits[(this.getseconds() % 10)]:""); [br]break; [br]} [br]output +=unit[5];

return output; [br]}
[br]/* [br]=========================================== [br]//轉換成農歷 [br]=========================================== [br]*/ [br]date.prototype.tochinese = function() [br]{ [br]//暫缺 [br]}
/* [br]=========================================== [br]//是否是閏年 [br]=========================================== [br]*/ [br]date.prototype.isleapyear = function() [br]{ [br]return (0==this.getyear()%4&&((this.getyear()%100!=0)||(this.getyear()%400==0))); [br]}
/* [br]=========================================== [br]//獲得該月的天數 [br]=========================================== [br]*/ [br]date.prototype.getdaycountinmonth = function() [br]{ [br]var mon = new array(12);
mon[0] = 31; mon[1] = 28; mon[2] = 31; mon[3] = 30; mon[4] = 31; mon[5] = 30; [br] mon[6] = 31; mon[7] = 31; mon[8] = 30; mon[9] = 31; mon[10] = 30; mon[11] = 31;
if(0==this.getyear()%4&&((this.getyear()%100!=0)||(this.getyear()%400==0))&&this.getmonth()==2) [br]{ [br]return 29; [br]} [br]else [br]{ [br]return mon[this.getmonth()]; [br]} [br]}
[br]/* [br]=========================================== [br]//日期比較 [br]=========================================== [br]*/ [br]date.prototype.compare = function(objdate) [br]{ [br]if(typeof(objdate)!="object" && objdate.constructor != date) [br]{ [br]return -2; [br]}
var d = this.gettime() - objdate.gettime();
if(d>0) [br]{ [br]return 1; [br]} [br]else if(d==0) [br]{ [br]return 0; [br]} [br]else [br]{ [br]return -1; [br]} [br]}
/* [br]=========================================== [br]//格式化日期格式 [br]=========================================== [br]*/ [br]date.prototype.format = function(formatstr) [br]{ [br]var str = formatstr;
str=str.replace(/yyyy|yyyy/,this.getfullyear()); [br]str=str.replace(/yy|yy/,(this.getyear() % 100)>9?(this.getyear() % 100).tostring():"0" + (this.getyear() % 100));
str=str.replace(/mm/,this.getmonth()>9?this.getmonth().tostring():"0" + this.getmonth()); [br]str=str.replace(/m/g,this.getmonth());
str=str.replace(/dd|dd/,this.getdate()>9?this.getdate().tostring():"0" + this.getdate()); [br]str=str.replace(/d|d/g,this.getdate());
str=str.replace(/hh|hh/,this.gethours()>9?this.gethours().tostring():"0" + this.gethours()); [br]str=str.replace(/h|h/g,this.gethours());
str=str.replace(/mm/,this.getminutes()>9?this.getminutes().tostring():"0" + this.getminutes()); [br]str=str.replace(/m/g,this.getminutes());
str=str.replace(/ss|ss/,this.getseconds()>9?this.getseconds().tostring():"0" + this.getseconds()); [br]str=str.replace(/s|s/g,this.getseconds());
return str; [br]}
[br]/* [br]=========================================== [br]//由字符串直接實例日期對象 [br]=========================================== [br]*/ [br]date.prototype.instancefromstring = function(str) [br]{ [br]return new date("2004-10-10".replace(/-/g, "\/")); [br]}
/* [br]=========================================== [br]//得到日期年月日等加數字后的日期 [br]=========================================== [br]*/ [br]date.prototype.dateadd = function(interval,number) [br]{ [br]var date = this;
switch(interval) [br] { [br] case "y" : [br] date.setfullyear(date.getfullyear()+number); [br] return date;
case "q" : [br] date.setmonth(date.getmonth()+number*3); [br] return date;
case "m" : [br] date.setmonth(date.getmonth()+number); [br] return date;
case "w" : [br] date.setdate(date.getdate()+number*7); [br] return date; [br] [br] case "d" : [br] date.setdate(date.getdate()+number); [br] return date;
case "h" : [br] date.sethours(date.gethours()+number); [br] return date;
case "m" : [br] date.setminutes(date.getminutes()+number); [br] return date;
case "s" : [br] date.setseconds(date.getseconds()+number); [br] return date;
default : [br] date.setdate(d.getdate()+number); [br] return date; [br] } [br]}
/* [br]=========================================== [br]//計算兩日期相差的日期年月日等 [br]=========================================== [br]*/ [br]date.prototype.datediff = function(interval,objdate) [br]{ [br]//暫缺 [br]}
[br]/* [br]****************************************** [br]數字函數擴充 [br]****************************************** [br]*/
/* [br]=========================================== [br]//轉換成中文大寫數字 [br]=========================================== [br]*/ [br]number.prototype.tochinese = function() [br]{ [br]var num = this; [br] if(!/^\d*(\.\d*)?$/.test(num)){alert("number is wrong!"); return "number is wrong!";}
var aa = new array("零","壹","貳","叁","肆","伍","陸","柒","捌","玖"); [br] var bb = new array("","拾","佰","仟","萬","億","點",""); [br] [br] var a = (""+ num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
for(var i=a[0].length-1; i>=0; i--) [br] { [br] switch(k) [br] { [br] case 0 : re = bb[7] + re; break; [br] case 4 : if(!new regexp("0{4}\\d{"+ (a[0].length-i-1) +"}$").test(a[0])) [br] re = bb[4] + re; break; [br] case 8 : re = bb[5] + re; bb[7] = bb[5]; k = 0; break; [br] } [br] if(k%4 == 2 && a[0].charat(i+2) != 0 && a[0].charat(i+1) == 0) re = aa[0] + re; [br] if(a[0].charat(i) != 0) re = aa[a[0].charat(i)] + bb[k%4] + re; k++; [br] }
if(a.length>1) //加上小數部分(如果有小數部分) [br] { [br] re += bb[6]; [br] for(var i=0; i }
/* [br]=========================================== [br]//保留小數點位數 [br]=========================================== [br]*/ [br]number.prototype.tofixed=function(len) [br]{
if(isnan(len)||len==null) [br]{ [br]len = 0; [br]} [br]else [br]{ [br]if(len<0) [br]{ [br]len = 0; [br]} [br]}
return math.round(this * math.pow(10,len)) / math.pow(10,len);
}
/* [br]=========================================== [br]//轉換成大寫金額 [br]=========================================== [br]*/ [br]number.prototype.tomoney = function() [br]{ [br]// constants: [br]var maximum_number = 99999999999.99; [br]// predefine the radix characters and currency symbols for output: [br]var cn_zero= "零"; [br]var cn_one= "壹"; [br]var cn_two= "貳"; [br]var cn_three= "叁"; [br]var cn_four= "肆"; [br]var cn_five= "伍"; [br]var cn_six= "陸"; [br]var cn_seven= "柒"; [br]var cn_eight= "捌"; [br]var cn_nine= "玖"; [br]var cn_ten= "拾"; [br]var cn_hundred= "佰"; [br]var cn_thousand = "仟"; [br]var cn_ten_thousand= "萬"; [br]var cn_hundred_million= "億"; [br]var cn_symbol= ""; [br]var cn_dollar= "元"; [br]var cn_ten_cent = "角"; [br]var cn_cent= "分"; [br]var cn_integer= "整"; [br] [br]// variables: [br]var integral; // represent integral part of digit number. [br]var decimal; // represent decimal part of digit number. [br]var outputcharacters; // the output result. [br]var parts; [br]var digits, radices, bigradices, decimals; [br]var zerocount; [br]var i, p, d; [br]var quotient, modulus; [br] [br]if (this > maximum_number) [br]{ [br]return ""; [br]} [br] [br]// process the coversion from currency digits to characters: [br]// separate integral and decimal parts before processing coversion:
parts = (this + "").split("."); [br]if (parts.length > 1) [br]{ [br]integral = parts[0]; [br]decimal = parts[1]; [br]// cut down redundant decimal digits that are after the second. [br]decimal = decimal.substr(0, 2); [br]} [br]else [br]{ [br]integral = parts[0]; [br]decimal = ""; [br]} [br]// prepare the characters corresponding to the digits: [br]digits= new array(cn_zero, cn_one, cn_two, cn_three, cn_four, cn_five, cn_six, cn_seven, cn_eight, cn_nine); [br]radices= new array("", cn_ten, cn_hundred, cn_thousand); [br]bigradices= new array("", cn_ten_thousand, cn_hundred_million); [br]decimals= new array(cn_ten_cent, cn_cent);
// start processing: [br] outputcharacters = ""; [br]// process integral part if it is larger than 0: [br]if (number(integral) > 0) [br]{ [br]zerocount = 0; [br]for (i = 0; i < integral.length; i++) [br]{ [br]p = integral.length - i - 1; [br]d = integral.substr(i, 1); [br]quotient = p / 4; [br]modulus = p % 4; [br]if (d == "0") [br]{ [br]zerocount++; [br]} [br]else [br]{ [br]if (zerocount > 0) [br]{ [br]outputcharacters += digits[0]; [br]} [br]zerocount = 0; [br]outputcharacters += digits[number(d)] + radices[modulus]; [br]}
if (modulus == 0 && zerocount < 4) [br]{ [br]outputcharacters += bigradices[quotient]; [br]} [br]}
outputcharacters += cn_dollar; [br]}
// process decimal part if there is: [br]if (decimal != "") [br]{ [br]for (i = 0; i < decimal.length; i++) [br]{ [br]d = decimal.substr(i, 1); [br]if (d != "0") [br]{ [br]outputcharacters += digits[number(d)] + decimals[i]; [br]} [br]} [br]}
// confirm and return the final output string: [br]if (outputcharacters == "") [br]{ [br]outputcharacters = cn_zero + cn_dollar; [br]} [br]if (decimal == "") [br]{ [br]outputcharacters += cn_integer; [br]}
outputcharacters = cn_symbol + outputcharacters; [br]return outputcharacters; [br]}
[br]number.prototype.toimage = function() [br]{ [br]var num = array( [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x5,0x5,0x5,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0x4,0x4,0x4,0x4,0x4}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x4,0xf,0x1,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x4,0xf,0x4,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0x5,0x5,0xf,0x4,0x4}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x1,0xf,0x4,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x1,0xf,0x5,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x4,0x4,0x4,0x4}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x5,0xf,0x5,0xf}", [br]"#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xf,0x5,0xf,0x4,0xf}" [br]);
var str = this + ""; [br]var iindex [br]var result="" [br]for(iindex=0;iindex [br]}
return result; [br]}
[br]/* [br]****************************************** [br]其他函數擴充 [br]****************************************** [br]*/
[br]/* [br]=========================================== [br]//驗證類函數 [br]=========================================== [br]*/ [br]function isempty(obj) [br]{
obj=document.getelementsbyname(obj).item(0); [br] if(trim(obj.value)=="") [br] { [br] [br] if(obj.disabled==false && obj.readonly==false) [br] { [br] obj.focus(); [br] } [br]return true; [br] } [br]else [br]{ [br]return false; [br]} [br]}
/* [br]=========================================== [br]//無模式提示對話框 [br]=========================================== [br]*/ [br]function modelessalert(msg) [br]{ [br] window.showmodelessdialog("javascript:alert(\""+escape(msg)+"\");window.close();","","status:no;resizable:no;h

該文章在 2010/4/26 23:18:39 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved