JavaScript 事件查詢綜合

來源:互聯網
上載者:User

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 onsubmit="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 當對象失去焦點
onsubmit=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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.