<!------------------///事件處理----------------------->
<!--1-事件源對象所對應的HTML標簽的事件屬性
<script language="javascript">
///事件處理
//1-事件源對象所對應的HTML標簽的事件屬性
function hideContextmenu()

{
window.event.returnValue=false;
}
</script>
<body oncontextmenu="hideContextmenu()">//oncontextmenu-右鍵關閉
或<body oncontextmenu="return false">
</body>
-->
<!--2-在javascript代碼中設置元素對象的事件屬性
<script language="javascript">
//2-在javascript代碼中設置元素對象的事件屬性
document.oncontextmenu=hideContextmenu;
function hideContextmenu()

{
return false;
}
</script>
-->
<!--在一個專門的<script>標簽對,用for屬性指定事件源,event屬性指定事件名
--常用于各種插件的處理
<script language="javascript" for="document" event="oncontextmenu">
//3-
window.event.returnValue=false;
</script>
-->
<!------------------///window對象----------------------->
<!--window的屬性我方法的引用可以省略window.這個前綴-->
<script language="javascript">
//-1-alert()方法--顯示OK提示對話框
//-2-confirm()方法--顯示帶OK/cancel提示對話框,返加true或false

/**//*if(confirm("您好嗎?"))
{
alert("你好");
}
else
{
alert("您不好");
}*/
//-3-prompt()方法--輸入信息對話框,返回本文

/**//*var age=prompt("年齡","18");
alert(age);*/
//-4-navigate()方法--將當前窗口導航到一個新的url
//-5-setInterval()方法--設置每隔多長時間調用指定代碼,執行多次
//-6-setTimeout()方法--設置多長時間后調用指定代碼,只執行一次
//-7-clearInterval()方法--取消setInterval(),參數為setInterval()的返回值
//-8-clearTimeout()方法--取消setTimeout(),參數為setTimeout()的返回值
//-9-moveTo()方法--移動窗口
//-10-resizeTo()方法--改變窗口大小
//-11-open()方法
//-12-showModalDialog()方法--創建模態對話框,沒有一般用window.open()打開的窗口的所有屬性。

//-13-showModelessDialog()方法--方法用來創建一個顯示HTML內容的非模態對話框。
//window.open("information.html","_blank","top=0,left=0,width=200,height=200,toolbar=no");
</script>

<!------------------///window對象-frames數組對象----------------------->
<!--
<frameset rows="20%,80%">
<frame name=top src="top.html">
<frame name=bottom src="bottom.html">
</frameset>
<input type=button value="刷新"
onclick="window.parent.frames[1].location.reload()">
或onclick="parent.frames.bottom.location.reload()">
或onclick="parent.frames[bottom].location.reload()">
或onclick="parent.frames.item(1).location.reload()">
或onclick="parent.frames.item('bottom').location.reload()">
或onclick="parent.bottom.location.reload()">
或onclick="parent[bottom].location.reload()">
-->
<!------------------///window對象-event對象----------------------->
<script language="javascript">
//altKey屬性
//ctrlKey屬性
//shiftKey屬性
//clientX,clientY屬性--
//screenX,screenY屬性
//offsetX,offsetY屬性
//x,y屬性
//returnValue屬性
//cancelBubble屬性
//srcElement屬性
//keyCode屬性

/**//*function window_onkeypress()
{
alert(window.event.keyCode);
}
<body onkeypress=window_onkeypress()>
</body>*/
//button屬性
//示例

/**//*function checkCancel()
{
if(window.event.shiftKey)
window.event.cancelBubble=true;
}
function showSrc()
{
if(window.event.srcElement.tagName=="IMG")
alert(window.event.srcElement.src);
}
<body onclick="showSrc()">
<img onclick="checkCancel()" src="aaa.gif">
</body>*/
</script>
<!------------------///window對象-事件----------------------->
<script language="javascript">
//-onload事件
//-onunload事件
//-onbeforeunload事件

/**//*<body onload="alert('歡迎')" onunload="alert('再見')"
onbeforeunload="window.event.returnValue='小心'">
</body>*/
//-onclick事件
//-onmousemove事件
//-onmouseover事件
//-onmouseout事件
//-onmousedowm事件
//-onmouseup事件
//-onkeydown事件
//-onkeyup事件
//-onkeypress事件--用戶按了數字或字母鍵所產生的事件
</script>

<!------------------///window對象-屬性----------------------->
<script language="javascript">
//-closed屬性--返回true/false
//-opener屬性
//-defaultstatus屬性
//-status屬性
//-screenTop屬性--返回當前窗口左上角頂點在屏幕上的垂直位置
//-screenLeft屬性--返回當前窗口左上角頂點在屏幕上的水平位置
//////////子窗口調用父窗口的方法window.opener.start();

/**//*var child = window.open("information.html","_blank",
"width=200,height=200,toolbar=no");
function closeChild()
{
if(!child.closed)
child.close();
}
var space_num=0;
var dir=1;
function scroll()
{
var str_space="";
space_num=space_num+1*dir;
if(space_num>40 || space_num<=0)
{
dir=-1*dir;
}
for(var i=0;i<=space_num;i++)
{
str_space += " ";
}
window.status=str_space+"www.it315.org";
}
function start()
{
setInterval("scroll()",100);
}
<body onload="start()">
</body>*/
</script>

<!------------------///window對象-子對象----------------------->
<script language="javascript">
//-location對象--設置顯示當前url
//href屬性

/**//*window.location.href="http://www.it
";
等效于window.navigate("http://www.it
");*/
//replace()方法--載入一個url替代當前網頁,基本同于href屬性
//reload()方法--刷新當前網頁文檔
//opener.location.reload();//刷新父窗口
//-event對象
//-frames對象
//-screen對象
//-clipboardData對象
//-history對象
//-navigator對象
//-document對象
//Cookie屬性
//基本格式:name=value
//設置格式:name=value;expires=Fri,31 Dec 1999 23:59:59 GMT;path=/bookshop;domain=it315.org;secure
//-expires字段 保存的有效時間,刪除可以用設時間為以前來完成
//沒有設置expires將保存信息在內存中,關閉瀏覽器將消失
//-domain字段 本cookie在那個域中有效,沒有設置只對當前主機有效
//-path字段 設置cookie在服務器上的那個目錄下有效
//沒有設置path只在當前主機上的目錄下有效
//-secure字段
//讀取格式:name1=value1;name2=value2
//-cookie value的解碼頭
//javascript通常用escape和unescape函數

/**//*var never = new Date();
never.setTime(never.getTime()+10*365*24*60*60*1000);
var expString="experes="+never.toGMTString()+";";
document.cookie="area="+escape("北京海淀")+";"+expString;
document.write("area="+'escape("北京海淀")'+";"+expString);
document.cookie="zipcode=100080;"; */
//讀取cookie

/**//*function getCookie(name)
{
var result=null;
var myCookie=" "+document.cookie + ";";
var searchName=" "+name+"=";
var startOfCookie=myCookie.indexOf(searchName);
var endOfCookie;
if(startOfCookie != -1)
{
startOfCookie+=searchName.length;
endOfCookie=myCookie.indexOf(";",startOfCookie);
result=unescape(myCookie.substring(startOfCookie,endOfCookie));
}
return result;
}
document.write(document.cookie+"<br>");
document.write("area is"+getCookie("area")+
",and zipcode is"+getCookie("aipcode"));*/
//刪除cookie

/**//*document.cookie="area=" + escape("北京海淀")+
";experes=Sat, 8 Dec 2018 08:19:42 UTC;"; */
//<a href="temp.html">進入第二個頁面</a>
</script>
<!--------------------///<script>標簽屬性---------------------------->
<script language="javascript">
//defer屬性--告訴瀏覽器先解析HTML再解析script代碼.例:<script language="javascript" defer>
//language屬性
//type屬性 用來代替language屬性
//src屬性
</script>
<!------------------///document對象-對象屬性----------------------->
<script language="javascript">
//forms數組對象--<form>集合
//anchors數組對象--HTML中<a>標簽的name或id屬性集合
//links數組對象--HTML中<a>標簽的href屬性集合
//images數組對象--HTML中<img>標簽的集合
//scripts數組對象
//applets數組對象
//all數組對象--HTML中所有標簽集合
//訪問<img src="sample.gif" name=img1>的src值

/**//*document.all[7].src;
document.all.img1.src;
document.all["img1"].src;
document.all.item("img1").src;//使用item(name|index)方法
document.all.item(7).src;
document.images[0].src;
document.images.img1.src;
document.images["img1"].src;
document.images.item("img1").src;
document.images.item(0).src; */
//一組name相同的

/**//*document.images["sample",0];
document.images.item("sample",0);*/
//styleSheets數組對象-樣式表集合
//body對象
//title對象
</script>
<!------------------///document對象-方法----------------------->
<script language="javascript">
//-write()方法
//-writeln()方法
//-getElementByld()方法--根據id屬性值返回期對象
//-getElementByName()方法--返回name屬性值相同的對象數組
//-getElementsByTagName()方法--返回name屬性值相同的對象數組
//-createElement()方法--生產一個html對象
</script>
<!------------------///document對象--屬性--------------------->
<script language="javascript">
///<body>標簽相關屬性
//-alinkColor屬性--超連接被選中時的顏色
//-linkColor屬性--超連接的正常顏色
//-vlinkColor屬性--訪問過的超連接顏色
//-bgColor屬性--
//-fgColor屬性--文本的顏色
//-charset屬性
//defaultCharset屬性
//cookie屬性
//fileCreateDate屬性
//fileModefiedDate屬性
//fileSize屬性
//lastModified屬性
</script>
<!------------------///body對象--對象屬性--------------------->
<script language="javascript">
//-all數組
//-style對象
</script>
<!------------------///body對象--方法和專用屬性--------------------->
<script language="javascript">
//-appendChild()方法--

/**//*function createA()
{
var oa=document.createElement("A");
oa.href="http://www.it
.";
oa.innerText="ssssssssss";
document.body.appendChild(oa);
}*/
//-background 屬性
//-bgProperties 屬性
//-text
//top-bottom-left-rightMargin屬性
//通用屬性
//id屬性
//name屬性
//className屬性
//innerText屬性
//innerHTML 屬性
//outerText屬性
//outerHTML屬性
//offsetTop屬性--HTML元素邊界的左上角頂點的坐標與外層元素左上角坐標的距離
//offsetLeft屬性--HTML元素邊界的左上角頂點的坐標與外層元素左上角坐標的距離
//offsetWidth屬性--HTML元素的寬
//offsetHeight屬性
//clientTop屬性--元素可顯示區的坐標與該元素邊框的距離
//clientLeft屬性--元素可顯示區的坐標與該元素邊框的距離
//clientWidth屬性--可顯示區的寬
//clientHeight屬性
//scroll屬性--滾動條
//scrollTop屬性--滾動條下拉的距離
//scrollLeft屬性--滾動條右拉的距離
//scrollTop屬性
//scrollWidth屬性
</script>
<!------------------///body對象--事件--------------------->
<script language="javascript">
//-onselectstart事件
//-onscroll事件
</script>
<!------------------///form對象--事件--------------------->
<script language="javascript">
//-onsubmit事件--要使用return 語句-return MySubmit()
//-onChange事件--本文值改變或列表框值改變時
//-onSelect事件--單行或多行本文框被選擇時
//-onFocus事件--得到焦點
//-onBlur事件--失去焦點
//-children數組屬性
//-submit()方法
//-item()方法--返回元素對象
//-屬性name,target,title,emctype,encoding,method,action
</script>
<!------------------///form表單字段元素--方法和屬性--------------------->
<script language="javascript">
//-blur()方法
//-focus()方法
//-click()方法
//-select的add()方法

//-defaultValue屬性
//-disabled屬性
//-readOnly屬性
//-title屬性
//-value屬性
//-checked屬性
//列表框專有屬性
//multiple屬性
//selectedIndex屬性
//potions數組屬性
//列表框選擇項對象<option>的屬性
//text屬性
//value屬性
//selected屬性
//index屬性
//自定義屬性
//<input type=text name="email" mark="1">
</script>
posted on 2009-11-29 21:51
junly 閱讀(440)
評論(0) 編輯 收藏 所屬分類:
ajax/jquery/js