




已閱讀5頁,還剩79頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
javascript事件查詢綜合click() 對(duì)象.click() 使對(duì)象被點(diǎn)擊。closed 對(duì)象.closed 對(duì)象窗口是否已關(guān)閉true/falseclearTimeout(對(duì)象) 清除已設(shè)置的setTimeout對(duì)象clearInterval(對(duì)象) 清除已設(shè)置的setInterval對(duì)象confirm(提示信息) 彈出確認(rèn)框,確定返回true取消返回falsecursor:樣式 更改鼠標(biāo)樣式 hand crosshair text wait help default auto e/s/w/n-resizeevent.clientX 返回最后一次點(diǎn)擊鼠標(biāo)X坐標(biāo)值;event.clientY 返回最后一次點(diǎn)擊鼠標(biāo)Y坐標(biāo)值;event.offsetX 返回當(dāng)前鼠標(biāo)懸停X坐標(biāo)值event.offsetY 返回當(dāng)前鼠標(biāo)懸停Y坐標(biāo)值document.write(document.lastModified) 網(wǎng)頁最后一次更新時(shí)間document.ondblclick=x 當(dāng)雙擊鼠標(biāo)產(chǎn)生事件document.onmousedown=x 單擊鼠標(biāo)鍵產(chǎn)生事件document.body.scrollTop; 返回和設(shè)置當(dāng)前豎向滾動(dòng)條的坐標(biāo)值,須與函數(shù)配合,document.body.scrollLeft; 返回和設(shè)置當(dāng)前橫向滾動(dòng)務(wù)的坐標(biāo)值,須與函數(shù)配合,document.title document.title=message; 當(dāng)前窗口的標(biāo)題欄文字document.bgcolor document.bgcolor=顏色值; 改變窗口背景顏色document.Fgcolor document.Fgcolor=顏色值; 改變正文顏色document.linkcolor document.linkcolor=顏色值; 改變超聯(lián)接顏色document.alinkcolor document.alinkcolor=顏色值; 改變正點(diǎn)擊聯(lián)接的顏色document.VlinkColor document.VlinkColor=顏色值; 改變已訪問聯(lián)接的顏色document.forms.length 返回當(dāng)前頁form表單數(shù)document.anchors.length 返回當(dāng)前頁錨的數(shù)量document.links.length 返回當(dāng)前頁聯(lián)接的數(shù)量document.onmousedown=x 單擊鼠標(biāo)觸發(fā)事件document.ondblclick=x 雙擊鼠標(biāo)觸發(fā)事件defaultStatus window.status=defaultStatus; 將狀態(tài)欄設(shè)置默認(rèn)顯示function function xx(). 定義函數(shù)isNumeric 判斷是否是數(shù)字innerHTML xx=對(duì)象.innerHTML 輸入某對(duì)象標(biāo)簽中的html源代碼innerText divid.innerText=xx 將以div定位以id命名的對(duì)象值設(shè)為XXlocation.reload(); 使本頁刷新,target可等于一個(gè)刷新的網(wǎng)頁Math.random() 隨機(jī)涵數(shù),只能是0到1之間的數(shù),如果要得到其它數(shù),可以為*10,再取整Math.floor(number) 將對(duì)象number轉(zhuǎn)為整數(shù),舍取所有小數(shù)Math.min(1,2) 返回1,2哪個(gè)小Math.max(1,2) 返回1,2哪個(gè)大navigator.appName 返回當(dāng)前瀏覽器名稱navigator.appVersion 返回當(dāng)前瀏覽器版本號(hào)navigator.appCodeName 返回當(dāng)前瀏覽器代碼名字navigator.userAgent 返回當(dāng)前瀏覽器用戶代標(biāo)志onsubmit onsubmit=return(xx() 使用函數(shù)返回值opener opener.document.對(duì)象 控制原打開窗體對(duì)象prompt xx=mpt(提示信息,預(yù)定值); 輸入語句parent parent.框架名.對(duì)象 控制框架頁面return return false 返回值random 隨機(jī)參數(shù)(0至1之間)reset() form.reset(); 使form表單內(nèi)的數(shù)據(jù)重置split() string.split() 將string對(duì)象字符以逗號(hào)隔開submit() form對(duì)象.submit() 使form對(duì)象提交數(shù)據(jù)String對(duì)象的 charAt(x)對(duì)象 反回指定對(duì)象的第多少位的字母lastIndexOf(string) 從右到左詢找指定字符,沒有返回-1indexOf(string) 從左到右詢找指定字符,沒有返回-1LowerCase() 將對(duì)象全部轉(zhuǎn)為小寫 UpperCase() 將對(duì)象全部轉(zhuǎn)為大寫substring(0,5) string.substring(x,x) 返回對(duì)象中從0到5的字符setTimeout(function,time) 設(shè)置一個(gè)超時(shí)對(duì)象setInterval(function,time) 設(shè)置一個(gè)超時(shí)對(duì)象toLocaleString() x.toLocaleString() 從x時(shí)間對(duì)象中獲取時(shí)間,以字符串型式存在typeof(變量名) 檢查變量的類型,值有:String,Boolean,Object,Function,Underfinedwindow.event.button=1/2/3 鼠標(biāo)鍵左鍵等于1右鍵等于2兩個(gè)鍵一起按為3window.screen.availWidth 返回當(dāng)前屏幕寬度(空白空間)window.screen.availHeight 返回當(dāng)前屏幕高度(空白空間)window.screen.width 返回當(dāng)前屏幕寬度(分辨率值)window.screen.height 返回當(dāng)前屏幕高度(分辨率值)window.document.body.offsetHeight; 返回當(dāng)前網(wǎng)頁高度window.document.body.offsetWidth; 返回當(dāng)前網(wǎng)頁寬度window.resizeTo(0,0) 將窗口設(shè)置寬高window.moveTo(0,0) 將窗口移到某位置window.focus() 使當(dāng)前窗口獲得焦點(diǎn)window.scroll(x,y) 窗口滾動(dòng)條坐標(biāo),y控制上下移動(dòng),須與函數(shù)配合window.open() window.open(地址,名稱,屬性) 屬性:toolbar(工具欄),location(地址欄),directions,status(狀態(tài)欄),menubar(菜單欄),scrollbar(滾動(dòng)條),resizable(改變大小), width(寬),height(高),fullscreen(全 屏),scrollbars(全屏?xí)r無滾動(dòng)條無參 數(shù),channelmode(寬屏),left(打開窗口x坐標(biāo)),top(打開窗口y坐標(biāo))window.location = view-source: + window.location.href 應(yīng)用事件查看網(wǎng)頁源代碼;a=new Date(); /創(chuàng)建a為一個(gè)新的時(shí)期對(duì)象y=a.getYear(); /y的值為從對(duì)象a中獲取年份值 兩位數(shù)年份y1=a.getFullYear(); /獲取全年份數(shù) 四位數(shù)年份m=a.getMonth(); /獲取月份值d=a.getDate(); /獲取日期值d1=a.getDay(); /獲取當(dāng)前星期值h=a.getHours(); /獲取當(dāng)前小時(shí)數(shù)m1=a.getMinutes(); /獲取當(dāng)前分鐘數(shù)s=a.getSeconds(); /獲取當(dāng)前秒鐘數(shù)對(duì)象.style.fontSize=文字大小;單位:mm/cm/in英寸/pc帕/pt點(diǎn)/px象素/em文字高1in=1.25cm1pc=12pt1pt=1.2px(800*600分辯率下)文本字體屬性:fontSize大小family字體color顏色fontStyle風(fēng)格,取值為normal一般,italic斜體,oblique斜體且加粗fontWeight加粗,取值為100到900不等,900最粗,light,normal,boldletterSpacing間距,更改文字間距離,取值為,1pt,10px,1cmtextDecoration:文字修飾;取值,none不修飾,underline下劃線,overline上劃線background:文字背景顏色,backgroundImage:背景圖片,取值為圖片的插入路徑點(diǎn)擊網(wǎng)頁正文函數(shù)調(diào)用觸發(fā)器:1.onClick 當(dāng)對(duì)象被點(diǎn)擊2.onLoad 當(dāng)網(wǎng)頁打開,只能書寫在body中3.onUnload 當(dāng)網(wǎng)頁關(guān)閉或離開時(shí),只能書寫在body中4.onmouseover 當(dāng)鼠標(biāo)懸于其上時(shí)5.onmouseout 當(dāng)鼠標(biāo)離開對(duì)象時(shí)6.onmouseup 當(dāng)鼠標(biāo)松開7.onmousedown 當(dāng)鼠標(biāo)按下鍵8.onFocus 當(dāng)對(duì)象獲取焦點(diǎn)時(shí)9.onSelect 當(dāng)對(duì)象的文本被選中時(shí)10.onChange 當(dāng)對(duì)象的內(nèi)容被改變11.onBlur 當(dāng)對(duì)象失去焦點(diǎn)onsubmit=return(ss()表單調(diào)用時(shí)返回的值直線 border-bottom:1x solid black虛線 border-bottom:1x dotted black點(diǎn)劃線 border-bottom:2x dashed black雙線 border-bottom:5x double black槽狀 border-bottom:1x groove black脊?fàn)?border-bottom:1x ridge black1.邊緣高光glow(color=顏色,strength=亮光大小)2.水平翻轉(zhuǎn)fliph() 使對(duì)象水平翻轉(zhuǎn)180度3.垂直翻轉(zhuǎn)flipv() 使對(duì)象垂直翻轉(zhuǎn)180度4.對(duì)象模糊blur(add=true/false direction=方向 strength=強(qiáng)度)add指定是否按印象畫派進(jìn)行模糊direction模糊方向strength模糊強(qiáng)度5.對(duì)象透明alpha(opaction=0-100,finishopacity=0-100,style=0/1/2/3)opaction對(duì)象整體不透明值finishopacity當(dāng)對(duì)象利用了漸透明時(shí)該項(xiàng)指定結(jié)束透明位置的不透明值style指定透明方式0為整體透明,1為線型透明,2為圓型透明,3為矩形透明6.去除顏色chroma(color=顏色值)使對(duì)象中顏色與指定顏色相同區(qū)域透明7.建立陰影dropshadow(color=陰影顏色,offx=水平向左偏離像素,offy=水平向下偏離像素)8.去色gray()使對(duì)象呈灰度顯示9.負(fù)片效果invert()使對(duì)象呈底片效果10.高光light()使對(duì)象呈黑色顯示11.遮蓋mask(color=顏色)使整個(gè)對(duì)象以指定顏色進(jìn)行蒙板一次opacity 表透明度水平.0100,0表全透明,100表完全不透明finishopacity表想要設(shè)置的漸變透明效果.0100.style 表透明區(qū)的形狀.0表統(tǒng)一形狀.1表線形.2表放射形.3表長方形.startx.starty表漸變透明效果的開始時(shí)X和Y坐標(biāo).finishx,finishy漸變透明效果結(jié)束時(shí)x,y 的坐標(biāo).add有來確定是否在模糊效果中使有原有目標(biāo).值為0,1.0表否,1表是.direction設(shè)置模糊的方向.0度表垂直向上,45度為一個(gè)單位.默認(rèn)值是向左270度.left,right,down,up.strength 只能用整數(shù)來確定.代表有多少個(gè)像素的寬度將受到模糊影響.默認(rèn)是5個(gè).color要透明的顏色.offx,offy分別是x,y 方向陰影的偏移量.positive指投影方式.0表透明像素生成陰影.1表只給出不透明像素生成陰影.AddAmbient:加入包圍的光源.AddCone:加入錐形光源.AddPoint加入點(diǎn)光源Changcolor:改變光的顏色Changstrength:改變光源的強(qiáng)度Clear:清除所有的光源MoveLight:移動(dòng)光源freq是波紋的頻率,在指定在對(duì)象上一區(qū)需要產(chǎn)生多少個(gè)完事的波紋lightstrength可對(duì)于波紋增強(qiáng)光影的效果顯著0100正整數(shù),正弦波開始位置是0360度0表從0度開始,25表從90度開始strength表振幅大小hand style=cursor:handcrosshair style=cursor:crosshairtext style=cursor:textwait style=cursor:waitdefault style=cursor:default help style=cursor:helpe-resize style=cursor:e-resizene-resize style=cursor:ne-resizen-resize style=cursor:n-resizenw-resize style=cursor:nw-resizew-resize style=cursor:w-resizes-resize style=cursor:s-resizesw-resize style=cursor:sw-resize se-resize style=cursor:se-resizeauto style=cursor:auto 數(shù)字輸入控制,給數(shù)字加上千分符 .inputRight text-align: right;border: 1px #666666 dashed; font-size: 9pt; color: #993366; height: 18px; ime-mode : disabled;/*這些功能建議通過HTC來實(shí)現(xiàn)*/數(shù)字輸入控制function FormatInput(dotlen)var myEle=event.srcElement;var myValue=String.fromCharCode(event.keyCode);if (myEle.readOnly)return;switch(dotlen)/原正則表達(dá)式(可以輸入負(fù)數(shù)):/-?d*.?d0,0$/case 0:event.returnValue = regInput(myEle, /d*.?d0,0$/, myValue); break;case 1:event.returnValue = regInput(myEle, /d*.?d0,1$/, myValue); break;case 2:event.returnValue = regInput(myEle, /d*.?d0,2$/, myValue); break;case 3:event.returnValue = regInput(myEle, /d*.?d0,3$/, myValue); break;case 4:event.returnValue = regInput(myEle, /d*.?d0,4$/, myValue); break;case 5:event.returnValue = regInput(myEle, /d*.?d0,5$/, myValue); break;case 6:event.returnValue = regInput(myEle, /d*.?d0,6$/, myValue); break;case 7:event.returnValue = regInput(myEle, /d*.?d0,7$/, myValue); break;case 8:event.returnValue = regInput(myEle, /d*.?d0,8$/, myValue); break;default :event.returnValue = regInput(myEle, /d*.?d0,0$/, myValue); break;function regInput(obj, reg, inputStr)var docSel = document.selection.createRange()if (docSel.parentElement().tagName != INPUT) return falseoSel = docSel.duplicate()oSel.text = var srcRange = obj.createTextRange()oSel.setEndPoint(StartToStart, srcRange)var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)return reg.test(str)/給數(shù)字加上千分符 by yuanzy function splitNumber(eValue)var intPart = ;var decPart = ;if (eValue.indexOf(,)=0)eValue=eValue.replace(/,/g,);if (eValue.indexOf(.)=0)intPart=eValue.split(.)0;decPart=eValue.split(.)1;elseintPart = eValue;var num = intPart+; var re=/(-?d+)(d3)/ while(re.test(num) num=num.replace(re,$1,$2) if (eValue.indexOf(.)=0)eValue=num + . + decPart;elseeValue=num ;return eValue;function oFocus()if (event.srcElement.readOnly) return;event.srcElement.value=event.srcElement.value.replace(/,/g,);function oBlur()if (event.srcElement.value=-)event.srcElement.value=;event.srcElement.value = splitNumber(event.srcElement.value);IE功能匯總 窗口打開自動(dòng)最大化代碼 if(window.screenLeft!=0) max.Click(); 利用腳本封裝,方便實(shí)現(xiàn)網(wǎng)站懸浮廣告下面是JS腳本(floatdiv.js)/*=浮動(dòng)塊支持腳本DESIGN BY : 彭國輝DATE: 2004-02-26SITE: /BLOG: /nhconchEMAIL: 搜索更多相關(guān)主題的帖子: javascriptfalsehelp 2006-10-16 16:41:03 islet等級(jí):貴賓威望:89帖子:6552專家分:0注冊(cè):2005-1-28第 2 樓 得分:0 文章為作者原創(chuàng),轉(zhuǎn)載前請(qǐng)先與本人聯(lián)系,轉(zhuǎn)載請(qǐng)注明文章出處、保留作者信息,謝謝支持!=*/var alLeft = 0, alCenter = 1, alRight = 2; /水平對(duì)齊方式var alTop = 0, alMiddle = 1, alBottom = 2; /垂直對(duì)齊方式var f = new Array();var cnt = 0;function floatDiv(objId, align, vAlign, x, y, smooth)/*浮動(dòng)塊對(duì)象數(shù)據(jù)結(jié)構(gòu):objId: 對(duì)象IDalign: 水平對(duì)齊方式,枚舉型vAlign:垂直對(duì)齊方式,枚舉型內(nèi)容x, y: xy座標(biāo),整型smooth:平滑移動(dòng),布爾型*/this.objId = objId;this.align = align;this.vAlign = vAlign;this.x = x;this.y = y;this.smooth = smooth;function addDiv(objId, align, vAlign, x, y, smooth) /添加浮動(dòng)塊fcnt+ = new floatDiv(objId, align, vAlign, x, y, smooth);function floatMove() /重新定位各塊位置var objX, objY;if (document.all)var d = document.body;/status = scrollLeft:+f0.objId.style.pixelTop+| offsetWidth:+d.offsetWidth;for (var i=0; if.length; i+)switch (fi.align)case alLeft : objX = d.scrollLeft + fi.x; break;case alCenter: objX = d.scrollLeft + Math.ceil(d.offsetWidth - fi.objId.offsetWidth)/2) + fi.x; break;case alRight : objX = d.scrollLeft + d.offsetWidth - fi.x - fi.objId.offsetWidth - 20; break; /減滾動(dòng)條20switch (fi.vAlign)case alTop : objY = d.scrollTop + fi.y; break;case alMiddle: objY = d.scrollTop + Math.ceil(d.offsetHeight - fi.objId.offsetHeight)/2) + fi.y; break;case alBottom: objY = d.scrollTop + d.offsetHeight - fi.y - fi.objId.offsetHeight; break;if (fi.smooth) smoothMove(fi.objId, objX, objY);elsefi.objId.style.pixelLeft = objX;fi.objId.style.pixelTop = objY;if (document.layers)for (var i=0; i 0) percent = Math.ceil(percent); else percent = Math.floor(percent);obj.style.pixelLeft += percent;percent = .1 * (y - obj.style.pixelTop);if (percent 0) percent = Math.ceil(percent); else percent = Math.floor(percent);obj.style.pixelTop += percent;if (document.layers)percent = .1 * (x - document.objId.left);if (percent 0) percent = Math.ceil(percent); else percent = Math.floor(percent);document.objId.left += percent;percent = .1 * (y - document.objId.top);if (percent 0) percent = Math.ceil(percent); else percent = Math.floor(percent);document.objId.top += percent;setTimeout(floatMove();,50);調(diào)用例子:if (navigator.appName = Netscape)document.write();elsedocument.write();addDiv(ad_hr, alRight, alTop, 0, 30, true);原創(chuàng)自己定義的簡(jiǎn)單方法驗(yàn)證表單數(shù)據(jù) 方法很簡(jiǎn)單,先是定義好要驗(yàn)證的數(shù)組比如:check_array0= new Array(title,留言主題不能為空!);然后判斷,錯(cuò)誤的就提示定義的內(nèi)容,代碼如下:/表單驗(yàn)證程序;/定義獲取表單元素;function $() var elements = new Array(); for (var i = 0; i arguments.length; i+) var element = argumentsi; if (typeof element = string) element = document.getElementById(element); if (arguments.length = 1) return element; elements.push(element); return elements; function checkform()/定義要驗(yàn)證的表單數(shù)組;var check_array=new Array();check_array0= new Array(title,留言主題不能為空!);check_array1= new Array(name,姓名不能為空!);check_array2= new Array(email,電子郵件不能為空!);check_array3= new Array(phone,電話不能為空!);check_array4= new Array(note,留言內(nèi)容不能為空!);/驗(yàn)證定義表單是否為空;for(var i=0;icheck_array.length;i+) if($(check_arrayi0).value=)alert(check_arrayi1);$(check_arrayi0).focus();return false;幾個(gè)表單驗(yàn)證的function checkMail(obj,error)if (obj = null)return NULL;if (obj.value = )return EMPTY;var filter = /(a-zA-Z0-9_.-)+(a-zA-Z0-9-)+.)+(a-zA-Z0-92,4)+$/;if (filter.test(obj.value)return true;elsealert(error);return false;function verifyDottedIP(cntrl,errmsg1,errmsg2,flag)ip_str = cntrl.value;if (ip_str = ) if (flag = 1)alert(errmsg1);cntrl.select();return false;return true;elsevarval = 0;vari = index = 0;while (index ip_str.lastIndexOf(.)k = index;index = ip_str.indexOf(., index);val = t
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年鋰離子蓄電池行業(yè)發(fā)展分析及發(fā)展趨勢(shì)與投資前景預(yù)測(cè)研究報(bào)告
- 2025-2030年鋁合金電纜產(chǎn)業(yè)市場(chǎng)發(fā)展分析及前景趨勢(shì)與投資管理研究報(bào)告
- 2025-2030年鈦合金粉產(chǎn)業(yè)市場(chǎng)深度調(diào)研及發(fā)展趨勢(shì)與投資研究報(bào)告
- 2025-2030年遙控電動(dòng)病床行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年過濾棉行業(yè)競(jìng)爭(zhēng)格局分析及投資前景與戰(zhàn)略規(guī)劃研究報(bào)告
- 2025-2030年跑步機(jī)行業(yè)市場(chǎng)深度調(diào)研及發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
- 2025-2030年資產(chǎn)管理行業(yè)市場(chǎng)發(fā)展分析及投資前景研究報(bào)告
- 2025-2030年課外輔導(dǎo)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年自動(dòng)化機(jī)械手產(chǎn)業(yè)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年紅棗美容食品行業(yè)市場(chǎng)深度分析及競(jìng)爭(zhēng)格局與投資發(fā)展研究報(bào)告
- 2020-2024年各地中考語文試卷【標(biāo)點(diǎn)符號(hào)使用題】匯集練附答案解析
- 數(shù)據(jù)分析師歷年考試真題試題庫(含答案)
- 住宅小區(qū)園林景觀綠化工程施工組織設(shè)計(jì)方案
- 物質(zhì)的量說課
- 人教版八年級(jí)下冊(cè)歷史教案全冊(cè)
- 企業(yè)網(wǎng)絡(luò)設(shè)備資產(chǎn)清查合同
- 2024年北京普通高中學(xué)業(yè)水平等級(jí)性考試化學(xué)試題及答案
- C語言程序設(shè)計(jì) 課件 第5章-數(shù)組
- 住家護(hù)工聘用合同協(xié)議書
- 平面向量的基本定理(說課)
- 投標(biāo)擔(dān)保函樣式
評(píng)論
0/150
提交評(píng)論