隨筆-124  評論-49  文章-56  trackbacks-0
          <!------------------///事件處理----------------------->
              <!--1-事件源對象所對應(yīng)的HTML標(biāo)簽的事件屬性
              
          <script language="javascript">
                  
          ///事件處理
                  //1-事件源對象所對應(yīng)的HTML標(biāo)簽的事件屬性
                  function hideContextmenu()
                  
          {
                      window.event.returnValue
          =false;
                  }

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

              
          </script>
              
          -->
              
              
          <!--在一個(gè)專門的<script>標(biāo)簽對,用for屬性指定事件源,event屬性指定事件名
              
          --常用于各種插件的處理
              
          <script language="javascript" for="document" event="oncontextmenu">
              
          //3-
                  window.event.returnValue=false;
              
          </script>
              
          -->
              
              
          <!------------------///window對象----------------------->
              <!--window的屬性我方法的引用可以省略window.這個(gè)前綴-->
              
          <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()方法--將當(dāng)前窗口導(dǎo)航到一個(gè)新的url
                  
                  
          //-5-setInterval()方法--設(shè)置每隔多長時(shí)間調(diào)用指定代碼,執(zhí)行多次
                  
                  
          //-6-setTimeout()方法--設(shè)置多長時(shí)間后調(diào)用指定代碼,只執(zhí)行一次
                  
                  
          //-7-clearInterval()方法--取消setInterval(),參數(shù)為setInterval()的返回值
                  
                  
          //-8-clearTimeout()方法--取消setTimeout(),參數(shù)為setTimeout()的返回值
                  
                  
          //-9-moveTo()方法--移動(dòng)窗口
                  
                  
          //-10-resizeTo()方法--改變窗口大小
                  
                  
          //-11-open()方法
                  
                  
          //-12-showModalDialog()方法--創(chuàng)建模態(tài)對話框,沒有一般用window.open()打開的窗口的所有屬性。

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

              
          <!------------------///window對象-frames數(shù)組對象----------------------->
                  <!-- 
                  
          <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事件--用戶按了數(shù)字或字母鍵所產(chǎn)生的事件
              </script>

              
          <!------------------///window對象-屬性----------------------->
              <script language="javascript">
                  
          //-closed屬性--返回true/false
                  
                  
          //-opener屬性
                  
                  
          //-defaultstatus屬性
                  
                  
          //-status屬性
                  
                  
          //-screenTop屬性--返回當(dāng)前窗口左上角頂點(diǎn)在屏幕上的垂直位置
                  
                  
          //-screenLeft屬性--返回當(dāng)前窗口左上角頂點(diǎn)在屏幕上的水平位置
                  
                  
          //////////子窗口調(diào)用父窗口的方法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對象--設(shè)置顯示當(dāng)前url
                  //href屬性
                  /*window.location.href="http://www.it";
                  等效于window.navigate("http://www.it");
          */

                  
          //replace()方法--載入一個(gè)url替代當(dāng)前網(wǎng)頁,基本同于href屬性
                  //reload()方法--刷新當(dāng)前網(wǎng)頁文檔
                  //opener.location.reload();//刷新父窗口
                  
                  
          //-event對象
                  
                  
          //-frames對象
                  
                  
          //-screen對象
                  
                  
          //-clipboardData對象
                  
                  
          //-history對象
                  
                  
          //-navigator對象
                  
                  
          //-document對象
                  //Cookie屬性
                  //基本格式:name=value
                  //設(shè)置格式:name=value;expires=Fri,31 Dec 1999 23:59:59 GMT;path=/bookshop;domain=it315.org;secure
                  //-expires字段  保存的有效時(shí)間,刪除可以用設(shè)時(shí)間為以前來完成
                  //沒有設(shè)置expires將保存信息在內(nèi)存中,關(guān)閉瀏覽器將消失
                  //-domain字段  本cookie在那個(gè)域中有效,沒有設(shè)置只對當(dāng)前主機(jī)有效
                  //-path字段  設(shè)置cookie在服務(wù)器上的那個(gè)目錄下有效
                  //沒有設(shè)置path只在當(dāng)前主機(jī)上的目錄下有效
                  //-secure字段  
                  //讀取格式:name1=value1;name2=value2
                  
                  
          //-cookie value的解碼頭
                  //javascript通常用escape和unescape函數(shù)
                  /*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">進(jìn)入第二個(gè)頁面</a>
              </script>
              
              
          <!--------------------///<script>標(biāo)簽屬性---------------------------->
              <script language="javascript">
                  
          //defer屬性--告訴瀏覽器先解析HTML再解析script代碼.例:<script language="javascript" defer>
                  
                  
          //language屬性
                  
                  
          //type屬性 用來代替language屬性
                  
                  
          //src屬性
              </script>
              
              
          <!------------------///document對象-對象屬性----------------------->
              <script language="javascript">
                  
          //forms數(shù)組對象--<form>集合
                  
                  
          //anchors數(shù)組對象--HTML中<a>標(biāo)簽的name或id屬性集合
                  
                  
          //links數(shù)組對象--HTML中<a>標(biāo)簽的href屬性集合
                  
                  
          //images數(shù)組對象--HTML中<img>標(biāo)簽的集合
                  
                  
          //scripts數(shù)組對象
                  
                  
          //applets數(shù)組對象
                  
                  
          //all數(shù)組對象--HTML中所有標(biāo)簽集合
                  //訪問<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數(shù)組對象-樣式表集合
                  
                  
          //body對象
                  
                  
          //title對象
                  
              
          </script>
              
            
          <!------------------///document對象-方法----------------------->
              <script language="javascript">
                  
          //-write()方法
                  
                  
          //-writeln()方法
                  
                  
          //-getElementByld()方法--根據(jù)id屬性值返回期對象
                  
                  
          //-getElementByName()方法--返回name屬性值相同的對象數(shù)組
                  
                  
          //-getElementsByTagName()方法--返回name屬性值相同的對象數(shù)組
                  
                  
          //-createElement()方法--生產(chǎn)一個(gè)html對象
              </script>
              
              
          <!------------------///document對象--屬性--------------------->
              <script language="javascript">
                  
          ///<body>標(biāo)簽相關(guān)屬性
                  //-alinkColor屬性--超連接被選中時(shí)的顏色
                  
                  
          //-linkColor屬性--超連接的正常顏色
                  
                  
          //-vlinkColor屬性--訪問過的超連接顏色
                  
                  
          //-bgColor屬性--
                  
                  
          //-fgColor屬性--文本的顏色
                  
                  
          //-charset屬性
                  
                  
          //defaultCharset屬性
                  
                  
          //cookie屬性
                  
                  
          //fileCreateDate屬性
                  
                  
          //fileModefiedDate屬性
                  
                  
          //fileSize屬性
                  
                  
          //lastModified屬性
                  
              
          </script>
              
              
          <!------------------///body對象--對象屬性--------------------->
              <script language="javascript">
                  
          //-all數(shù)組
                  
                  
          //-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元素邊界的左上角頂點(diǎn)的坐標(biāo)與外層元素左上角坐標(biāo)的距離
                  
                  
          //offsetLeft屬性--HTML元素邊界的左上角頂點(diǎn)的坐標(biāo)與外層元素左上角坐標(biāo)的距離
                  
                  
          //offsetWidth屬性--HTML元素的寬
                  
                  
          //offsetHeight屬性
                  
                  
          //clientTop屬性--元素可顯示區(qū)的坐標(biāo)與該元素邊框的距離
                  
                  
          //clientLeft屬性--元素可顯示區(qū)的坐標(biāo)與該元素邊框的距離
                  
                  
          //clientWidth屬性--可顯示區(qū)的寬
                  
                  
          //clientHeight屬性
                  
                  
          //scroll屬性--滾動(dòng)條
                  
                  
          //scrollTop屬性--滾動(dòng)條下拉的距離
                  
                  
          //scrollLeft屬性--滾動(dòng)條右拉的距離
                  
                  
          //scrollTop屬性
                  
                  
          //scrollWidth屬性
              </script>
              
              
          <!------------------///body對象--事件--------------------->
              <script language="javascript">
                  
          //-onselectstart事件
                  
                  
          //-onscroll事件
                  
              
          </script>
              
              
          <!------------------///form對象--事件--------------------->
              <script language="javascript">
                  
          //-onsubmit事件--要使用return 語句-return MySubmit()
                  
                  
          //-onChange事件--本文值改變或列表框值改變時(shí)
                  
                  
          //-onSelect事件--單行或多行本文框被選擇時(shí)
                  
                  
          //-onFocus事件--得到焦點(diǎn)
                  
                  
          //-onBlur事件--失去焦點(diǎn)
                  
                  
          //-children數(shù)組屬性
                  
                  
          //-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屬性
                  
                  
          //列表框?qū)S袑傩?/span>
                  //multiple屬性
                  //selectedIndex屬性
                  //potions數(shù)組屬性
                  //列表框選擇項(xiàng)對象<option>的屬性
                  //text屬性
                  //value屬性
                  //selected屬性
                  //index屬性
                  
                  
          //自定義屬性
                  //<input type=text name="email" mark="1">
              </script>
          posted on 2009-11-29 21:51 junly 閱讀(444) 評論(0)  編輯  收藏 所屬分類: ajax/jquery/js
          主站蜘蛛池模板: 陕西省| 潜山县| 舟曲县| 贺州市| 石首市| 平乡县| 若羌县| 阜城县| 江陵县| 监利县| 陇川县| 永靖县| 旬邑县| 高青县| 东乌珠穆沁旗| 上杭县| 苏尼特右旗| 新乡市| 枝江市| 肥东县| 呼图壁县| 韶关市| 卢湾区| 西藏| 雷波县| 睢宁县| 德昌县| 山阴县| 双桥区| 陵川县| 徐闻县| 永平县| 鸡泽县| 和平县| 新和县| 彰化市| 大安市| 从化市| 鄂州市| 潼关县| 重庆市|