javascript 網頁事件

 javascript事件查詢綜合(轉)
javascript事件查詢綜合
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.οndblclick=x 當雙擊鼠標產生事件
document.οnmοusedοwn=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.οnmοusedοwn=x 單擊鼠標觸發事件
document.οndblclick=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 οnsubmit="return(xx())" 使用函數返回值
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; 返回當前網頁寬度
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(); //獲取當前秒鐘數


對象.style.fontSize="文字大小";
單位:mm/cm/in英寸/pc帕/pt點/px象素/em文字高
1in=1.25cm
1pc=12pt
1pt=1.2px(800*600分辯率下)

文本字體屬性:
fontSize大小
family字體
color顏色
fontStyle風格,取值爲normal一般,italic斜體,oblique斜體且加粗
fontWeight加粗,取值爲100到900不等,900最粗,light,normal,bold
letterSpacing間距,更改文字間距離,取值爲,1pt,10px,1cm
textDecoration:文字修飾;取值,none不修飾,underline下劃線,overline上劃線
background:文字背景顏色,
backgroundImage:背景圖片,取值爲圖片的插入路徑


點擊網頁正文函數調用觸發器:

1.onClick 當對象被點擊
2.onLoad 當網頁打開,只能書寫在body中
3.onUnload 當網頁關閉或離開時,只能書寫在body中
4.onmouseover 當鼠標懸於其上時
5.onmouseout 當鼠標離開對象時
6.onmouseup 當鼠標鬆開
7.onmousedown 當鼠標按下鍵
8.onFocus 當對象獲取焦點時
9.onSelect 當對象的文本被選中時
10.onChange 當對象的內容被改變
11.onBlur 當對象失去焦點
οnsubmit=return(ss())表單調用時返回的值

直線 border-bottom:1x solid black
虛線 border-bottom:1x dotted black
點劃線 border-bottom:2x dashed black
雙線 border-bottom:5x double black
槽狀 border-bottom:1x groove black
脊狀 border-bottom:1x ridge black
發佈了51 篇原創文章 · 獲贊 5 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章