javascript事件查詢綜合

okone96發表於2007-04-26
click() 物件.click() 使物件被點選。
closed 物件.closed 物件視窗是否已關閉true/false
clearTimeout(物件) 清除已設定的setTimeout物件
clearInterval(物件) 清除已設定的setInterval物件
confirm("提示資訊") 彈出確認框,確定返回true取消返回false
cursor:樣式 更改滑鼠樣式 hand crosshair text wait help default auto e/s/w/n-resize
event.clientX 返回最後一次點選滑鼠X座標值;
event.clientY 返回最後一次點選滑鼠Y座標值;
event.offsetX 返回當前滑鼠懸停X座標值
event.offsetY 返回當前滑鼠懸停Y座標值

document.write(document.lastModified) 網頁最後一次更新時間
document.ondblclick=x 當雙擊滑鼠產生事件
document.onmousedown=x 單擊滑鼠鍵產生事件

document.body.scrollTop; 返回和設定當前豎向捲軸的座標值,須與函式配合,
document.body.scrollLeft; 返回和設定當前橫向滾動務的座標值,須與函式配合,
document.title document.title="message"; 當前視窗的標題欄文字
document.bgcolor document.bgcolor="顏色值"; 改變視窗背景顏色
document.Fgcolor document.Fgcolor="顏色值"; 改變正文顏色
document.linkcolor document.linkcolor="顏色值"; 改變超聯接顏色
document.alinkcolor document.alinkcolor="顏色值"; 改變正點選聯接的顏色
document.VlinkColor document.VlinkColor="顏色值"; 改變已訪問聯接的顏色
document.forms.length 返回當前頁form表單數
document.anchors.length 返回當前頁錨的數量
document.links.length 返回當前頁聯接的數量
document.onmousedown=x 單擊滑鼠觸發事件
document.ondblclick=x 雙擊滑鼠觸發事件
defaultStatus window.status=defaultStatus; 將狀態列設定預設顯示

function function xx(){...} 定義函式
isNumeric 判斷是否是數字
innerHTML xx=物件.innerHTML 輸入某物件標籤中的html原始碼
innerText divid.innerText=xx 將以div定位以id命名的物件值設為XX

location.reload(); 使本頁重新整理,target可等於一個重新整理的網頁

Math.random() 隨機涵數,只能是0到1之間的數,如果要得到其它數,可以為*10,再取整
Math.floor(number) 將物件number轉為整數,舍取所有小數
Math.min(1,2) 返回1,2哪個小
Math.max(1,2) 返回1,2哪個大

navigator.appName 返回當前瀏覽器名稱
navigator.appVersion 返回當前瀏覽器版本號
navigator.appCodeName 返回當前瀏覽器程式碼名字
navigator.userAgent 返回當前瀏覽器使用者代標誌

onsubmit 使用函式返回值
opener opener.document.物件 控制原開啟窗體物件

prompt xx=window.prompt("提示資訊","預定值"); 輸入語句
parent parent.框架名.物件 控制框架頁面

return return false 返回值
random 隨機引數(0至1之間)
reset() form.reset(); 使form表單內的資料重置

split("") string.split("") 將string物件字元以逗號隔開
submit() form物件.submit() 使form物件提交資料

String物件的 charAt(x)物件 反回指定物件的第多少位的字母
lastIndexOf("string") 從右到左詢找指定字元,沒有返回-1
indexOf("string") 從左到右詢找指定字元,沒有返回-1
LowerCase() 將物件全部轉為小寫
UpperCase() 將物件全部轉為大寫
substring(0,5) string.substring(x,x) 返回物件中從0到5的字元
setTimeout("function",time) 設定一個超時物件
setInterval("function",time) 設定一個超時物件

toLocaleString() x.toLocaleString() 從x時間物件中獲取時間,以字串型式存在
typeof(變數名) 檢查變數的型別,值有:String,Boolean,Object,Function,Underfined

window.event.button==1/2/3 滑鼠鍵左鍵等於1右鍵等於2兩個鍵一起按為3
window.screen.availWidth 返回當前螢幕寬度(空白空間)
window.screen.availHeight 返回當前螢幕高度(空白空間)
window.screen.width 返回當前螢幕寬度(解析度值)
window.screen.height 返回當前螢幕高度(解析度值)
window.document.body.offsetHeight; 返回當前網頁高度
window.document.body.offsetWidth; 返回當前網頁寬度
document.body.clientWidth 返回瀏覽器寬度
document.body.clientHeight 返回瀏覽器高度
window.resizeTo(0,0) 將視窗設定寬高
window.moveTo(0,0) 將視窗移到某位置
window.focus() 使當前視窗獲得焦點
window.scroll(x,y) 視窗捲軸座標,y控制上下移動,須與函式配合
window.open() window.open("地址","名稱","屬性")
屬性:toolbar(工具欄),location(位址列),directions,status(狀態列),
menubar(選單欄),scrollbar(捲軸),resizable(改變大小),width(寬),height(高),fullscreen(全 屏),scrollbars(全屏時無捲軸無引數,channelmode(寬屏),left(開啟視窗x座標),top(開啟視窗y座標)
window.location = 'view-source:' + window.location.href 應用事件檢視網頁原始碼;


a=new Date(); //建立a為一個新的時期物件
y=a.getYear(); //y的值為從物件a中獲取年份值 兩位數年份
y1=a.getFullYear(); //獲取全年份數 四位數年份
m=a.getMonth(); //獲取月份值
d=a.getDate(); //獲取日期值
d1=a.getDay(); //獲取當前星期值
h=a.getHours(); //獲取當前小時數
m1=a.getMinutes(); //獲取當前分鐘數
s=a.getSeconds(); //獲取當前秒鐘數

點選網頁正文函式呼叫觸發器:

1.onClick 當物件被點選
2.onLoad 當網頁開啟,只能書寫在body中
3.onUnload 當網頁關閉或離開時,只能書寫在body中
4.onmouseover 當滑鼠懸於其上時
5.onmouseout 當滑鼠離開物件時
6.onmouseup 當滑鼠鬆開
7.onmousedown 當滑鼠按下鍵
8.onFocus 當物件獲取焦點時
9.onSelect 當物件的文字被選中時
10.onChange 當物件的內容被改變
11.onBlur 當物件失去焦點[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/750220/viewspace-912460/,如需轉載,請註明出處,否則將追究法律責任。

相關文章