<button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><ins id="nc8ni"><button id="nc8ni"><form id="nc8ni"></form></button></ins>
<button id="nc8ni"><form id="nc8ni"></form></button>
<form id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><button id="nc8ni"></button></ins>
<button id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></ins>
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><form id="nc8ni"></form></button>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form><button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins>
<button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form>
<ins id="nc8ni"><form id="nc8ni"></form></ins>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button>
<button id="nc8ni"></button>
<button id="nc8ni"></button>

Javascript腳本常用代碼

深山行者個(gè)人網(wǎng)站 2007/11/25 21:48:10 深山行者 字體: 瀏覽 6423

Javascript腳本常用代碼

click() 對象.click() 使對象被點(diǎn)擊
closed 對象.closed 對象窗口是否已關(guān)閉true/false
clearTimeout(對象) 清除已設置的setTimeout對象
clearInterval(對象) 清除已設置的setInterval對象
confirm("提示信息") 彈出確認框,確定返回true取消返回false


cursor:樣式 更改鼠標樣式 hand crosshair text wait help default auto e/s/w/n-resize
event.clientX 返回最后一次點(diǎn)擊鼠標X坐標值
event.clientY 返回最后一次點(diǎn)擊鼠標Y坐標值
event.offsetX 返回當前鼠標懸停X坐標值
event.offsetY 返回當前鼠標懸停Y坐標值


document.write(document.lastModified) 網(wǎng)頁(yè)最后一次更新時(shí)間
document.ondblclick=x 當雙擊鼠標產(chǎn)生事件
document.onmousedown=x 單擊鼠標鍵產(chǎn)生事件
document.body.scrollTop; 返回和設置當前豎向滾動(dòng)條的坐標值,須與函數配合,
document.body.scrollLeft; 返回和設置當前橫向滾動(dòng)務(wù)的坐標值,須與函數配合,
document.title document.title="message"; 當前窗口的標題欄文字
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="顏色值"; 改變已訪(fǎng)問(wèn)聯(lián)接的顏色
document.forms.length 返回當前頁(yè)form表單數
document.anchors.length 返回當前頁(yè)錨的數量
document.links.length 返回當前頁(yè)聯(lián)接的數量
document.onmousedown=x 單擊鼠標觸發(fā)事件
document.ondblclick=x 雙擊鼠標觸發(fā)事件

defaultStatus window.status=defaultStatus; 將狀態(tài)欄設置默認顯示
function function xx(){...} 定義函數
isNumeric 判斷是否是數字
innerHTML xx=對象.innerHTML 輸入某對象標簽中的html源代碼
innerText divid.innerText=xx 將以div定位以id命名的對象值設為XX
location.reload(); 使本頁(yè)刷新,target可等于一個(gè)刷新的網(wǎng)頁(yè)

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

navigator.appName 返回當前瀏覽器名稱(chēng)
navigator.appVersion 返回當前瀏覽器版本號
navigator.appCodeName 返回當前瀏覽器代碼名字
navigator.userAgent 返回當前瀏覽器用戶(hù)代標志

onsubmit onsubmit="return(xx())" 使用函數返回值
opener opener.document.對象 控制原打開(kāi)窗體對象
prompt xx=window.prompt("提示信息","預定值"); 輸入語(yǔ)句
parent parent.框架名.對象 控制框架頁(yè)面
return return false 返回值
random 隨機參數(0至1之間)
reset() form.reset(); 使form表單內的數據重置
split("") string.split("") 將string對象字符以逗號隔開(kāi)
submit() form對象.submit() 使form對象提交數據
String對象的 charAt(x)對象 反回指定對象的第多少位的字母
lastIndexOf("string") 從右到左詢(xún)找指定字符,沒(méi)有返回-1
indexOf("string") 從左到右詢(xún)找指定字符,沒(méi)有返回-1
LowerCase() 將對象全部轉為小寫(xiě)
UpperCase() 將對象全部轉為大寫(xiě)
substring(0,5) string.substring(x,x) 返回對象中從0到5的字符
setTimeout("function",time) 設置一個(gè)超時(shí)對象
setInterval("function",time) 設置一個(gè)超時(shí)對象
toLocaleString() x.toLocaleString() 從x時(shí)間對象中獲取時(shí)間,以字符串型式存在
typeof(變量名) 檢查變量的類(lèi)型,值有:String,Boolean,Object,Function,Underfined

window.event.button==1/2/3 鼠標鍵左鍵等于1右鍵等于2兩個(gè)鍵一起按為3
window.screen.availWidth 返回當前屏幕寬度(空白空間)
window.screen.availHeight 返回當前屏幕高度(空白空間)
window.screen.width 返回當前屏幕寬度(分辨率值)
window.screen.height 返回當前屏幕高度(分辨率值)
window.document.body.offsetHeight; 返回當前網(wǎng)頁(yè)高度
window.document.body.offsetWidth; 返回當前網(wǎng)頁(yè)寬度
window.resizeTo(0,0) 將窗口設置寬高
window.moveTo(0,0) 將窗口移到某位置
window.focus() 使當前窗口獲得焦點(diǎn)
window.scroll(x,y) 窗口滾動(dòng)條坐標,y控制上下移動(dòng),須與函數配合
window.open() window.open("地址","名稱(chēng)","屬性")
屬性:toolbar(工具欄),location(地址欄),directions,status(狀態(tài)欄),
menubar(菜單欄),scrollbar(滾動(dòng)條),resizable(改變大小), width(寬),height(高),fullscreen(全 屏),scrollbars(全屏時(shí)無(wú)滾動(dòng)條無(wú)參 數,channelmode(寬屏),left(打開(kāi)窗口x坐標),top(打開(kāi)窗口y坐標)
window.location = 'view-source:' + window.location.href 應用事件查看網(wǎng)頁(yè)源代碼;
a=new Date(); //創(chuàng )建a為一個(gè)新的時(shí)期對象
y=a.getYear(); //y的值為從對象a中獲取年份值 兩位數年份
y1=a.getFullYear(); //獲取全年份數 四位數年份
m=a.getMonth(); //獲取月份值
d=a.getDate(); //獲取日期值
d1=a.getDay(); //獲取當前星期值
h=a.getHours(); //獲取當前小時(shí)數
m1=a.getMinutes(); //獲取當前分鐘數
s=a.getSeconds(); //獲取當前秒鐘數

對象.style.fontSize="文字大小";
單位:mm/cm/in英寸/pc帕/pt點(diǎn)/px象素/em文字高
1in=1.25cm
1pc=12pt
1pt=1.2px(800*600分辯率下)
文本字體屬性:
fontSize大小
family字體
color顏色
fontStyle風(fēng)格,取值為normal一般,italic斜體,oblique斜體且加粗
fontWeight加粗,取值為100到900不等,900最粗,light,normal,bold
letterSpacing間距,更改文字間距離,取值為,1pt,10px,1cm
textDecoration:文字修飾;取值,none不修飾,underline下劃線(xiàn),overline上劃線(xiàn)
background:文字背景顏色,
backgroundImage:背景圖片,取值為圖片的插入路徑

點(diǎn)擊網(wǎng)頁(yè)正文函數調用觸發(fā)器:
1.onClick 當對象被點(diǎn)擊
2.onLoad 當網(wǎng)頁(yè)打開(kāi),只能書(shū)寫(xiě)在body中
3.onUnload 當網(wǎng)頁(yè)關(guān)閉或離開(kāi)時(shí),只能書(shū)寫(xiě)在body中
4.onmouseover 當鼠標懸于其上時(shí)
5.onmouseout 當鼠標離開(kāi)對象時(shí)
6.onmouseup 當鼠標松開(kāi)
7.onmousedown 當鼠標按下鍵
8.onFocus 當對象獲取焦點(diǎn)時(shí)
9.onSelect 當對象的文本被選中時(shí)
10.onChange 當對象的內容被改變
11.onBlur 當對象失去焦點(diǎn)

onsubmit=return(ss())表單調用時(shí)返回的值
直線(xiàn) border-bottom:1x solid black
虛線(xiàn) border-bottom:1x dotted black
點(diǎn)劃線(xiàn) border-bottom:2x dashed black
雙線(xiàn) border-bottom:5x double black
槽狀 border-bottom:1x groove black
脊狀 border-bottom:1x ridge black

1.邊緣高光glow(color=顏色,strength=亮光大小)
2.水平翻轉fliph() 使對象水平翻轉180度
3.垂直翻轉flipv() 使對象垂直翻轉180度
4.對象模糊blur(add=true/false direction=方向 strength=強度) add指定是否按印象畫(huà)派進(jìn)行模糊direction模糊方向strength模糊強度
5.對象透明alpha(opaction=0-100,finishopacity=0-100,style=0/1/2/3)
opaction對象整體不透明值finishopacity當對象利用了漸透明時(shí)該項指定結束透明位置的不透明值style指定透明方式0為整體透明,1為線(xiàn)型透明,2為圓型透明,3為矩形透明
6.去除顏色chroma(color=顏色值)使對象中顏色與指定顏色相同區域透明
7.建立陰影dropshadow(color=陰影顏色,offx=水平向左偏離像素,offy=水平向下偏離像素)
8.去色gray()使對象呈灰度顯示
9.負片效果invert()使對象呈底片效果
10.高光light()使對象呈黑色顯示
11.遮蓋mask(color=顏色)使整個(gè)對象以指定顏色進(jìn)行蒙板一次

opacity 表透明度水平.0~100,0表全透明,100表完全不透明
finishopacity表想要設置的漸變透明效果.0~100.
style 表透明區的形狀.0表統一形狀.1表線(xiàn)形.2表放射形.3表長(cháng)方形.
startx.starty表漸變透明效果的開(kāi)始時(shí)X和Y坐標.
finishx,finishy漸變透明效果結束時(shí)x,y 的坐標.
add有來(lái)確定是否在模糊效果中使有原有目標.值為0,1.0表"否",1表"是".
direction設置模糊的方向.0度表垂直向上,45度為一個(gè)單位.默認值是向左270度.left,right,down,up.
strength 只能用整數來(lái)確定.代表有多少個(gè)像素的寬度將受到模糊影響.默認是5個(gè).
color要透明的顏色.
offx,offy分別是x,y 方向陰影的偏移量.
positive指投影方式.0表透明像素生成陰影.1表只給出不透明像素生成陰影..
AddAmbient:加入包圍的光源.
AddCone:加入錐形光源.
AddPoint加入點(diǎn)光源
Changcolor:改變光的顏色.
Changstrength:改變光源的強度.
Clear:清除所有的光源.
MoveLight:移動(dòng)光源.
freq是波紋的頻率,在指定在對象上一區需要產(chǎn)生多少個(gè)完事的波紋.
lightstrength可對于波紋增強光影的效果.顯著(zhù)0~100正整數,正弦波開(kāi)始位置是0~360度.0表從0度開(kāi)始,25表從90度開(kāi)始.
strength表振幅大?。?

hand style="cursor:hand"
crosshair style="cursor:crosshair"
text style="cursor:text"
wait style="cursor:wait"
default style="cursor:default"
help style="cursor:help"
e-resize style="cursor:e-resize"
ne-resize style="cursor:ne-resize"
n-resize style="cursor:n-resize"
nw-resize style="cursor:nw-resize"
w-resize style="cursor:w-resize"
s-resize style="cursor:s-resize"
sw-resize style="cursor:sw-resize "
se-resize style="cursor:se-resize"
auto style="cursor:auto"

相關(guān)閱讀
利用position把div放在flash上
Photoshop中精典實(shí)用技巧
向各位網(wǎng)友匯報下許愿墻進(jìn)程。
微信小程序操作json與數組增加
微信小程序開(kāi)發(fā)中鏈接navigateTo與redirectTo的對比說(shuō)明
這個(gè)可以做為論壇,也可以做留言板
記錄滾動(dòng)條位置(使用userdate)
asp利用dateadd獲得上個(gè)月、本月、下個(gè)月的第一天和最后一天
共有0條關(guān)于《Javascript腳本常用代碼》的評論
發(fā)表評論
正在加載評論......
返回頂部發(fā)表評論
呢 稱(chēng):
表 情:
內 容:
評論內容:不能超過(guò) 1000 字,需審核,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。
驗證碼: 驗證碼 
網(wǎng)友評論聲明,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。

您發(fā)布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會(huì )、集體和公民的合法權益;
二、不得發(fā)布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發(fā)布內容擁有處置權。

更多信息>>欄目類(lèi)別選擇
百度小程序開(kāi)發(fā)
微信小程序開(kāi)發(fā)
微信公眾號開(kāi)發(fā)
uni-app
asp函數庫
ASP
DIV+CSS
HTML
python
更多>>同類(lèi)信息
jquery下拉到某個(gè)固定位置然后某些元素發(fā)生改變樣式狀態(tài)
canvas繪制的文字如何換行
兼容pc、移動(dòng)端用js實(shí)現復制內容到剪切板(支持蘋(píng)果safari瀏覽器)
js兼容多個(gè)瀏覽器右下角漂浮廣告
兼容ie6+和火狐的禁止右鍵
做在線(xiàn)客服時(shí),聊天窗口的div滾動(dòng)條始終在底部
更多>>最新添加文章
dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
Android移動(dòng)端自動(dòng)化測試:使用UIAutomatorViewer與Selenium定位元素
抖音直播音掛載小雪花 懂車(chē)帝小程序
javascript獲取瀏覽器指紋可以用來(lái)做投票
火狐Mozilla Firefox出現:無(wú)法載入您的Firefox配置文件 它可能已經(jīng)丟失 或是無(wú)法訪(fǎng)問(wèn) 問(wèn)題解決集合處理辦法
在A(yíng)ndroid、iOS、Windows、MacOS中微信小程序的文件存放路徑
python通過(guò)代碼修改pip下載源讓下載庫飛起
python里面requests.post返回的res.text還有其它的嗎
更多>>隨機抽取信息
asp中qequest讀取優(yōu)先級順序(通過(guò)優(yōu)化之后提高速度)
易游天下通-中南國際旅游公司
網(wǎng)站完成各個(gè)瀏覽器兼容測試
windows 部分熱鍵集錦
許愿墻開(kāi)始重新設計。
調整CSS類(lèi)型的順序改變鏈接翻滾效果
亚洲精品456在线|S级爆乳玩具酱国产VIP皮裤|欧美成人精品第一区二区三区|久久永久免费人妻精品我不卡|亚洲欧洲日产无码
<button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><ins id="nc8ni"><button id="nc8ni"><form id="nc8ni"></form></button></ins>
<button id="nc8ni"><form id="nc8ni"></form></button>
<form id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><button id="nc8ni"></button></ins>
<button id="nc8ni"><xmp id="nc8ni">
<ins id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></ins>
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><xmp id="nc8ni">
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><form id="nc8ni"></form></button>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button><button id="nc8ni"><xmp id="nc8ni"><button id="nc8ni"></button><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form><button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins>
<button id="nc8ni"><xmp id="nc8ni"><ins id="nc8ni"></ins><form id="nc8ni"><ins id="nc8ni"><form id="nc8ni"></form></ins></form>
<ins id="nc8ni"><form id="nc8ni"></form></ins>
<button id="nc8ni"><form id="nc8ni"><ins id="nc8ni"></ins></form></button>
<button id="nc8ni"></button>
<button id="nc8ni"></button>