枚舉 javascript 常用對象方法 By shawl.qiu

來源:互聯網
上載者:User

枚舉 javascript 常用對象方法 By shawl.qiu

說明:
學 JS 有一些日子了, 到今天為止, 基本遍覽了 核心JS 與 用戶端JS 的所有方法. 
期間弄了這麼一個可以迅速瞭解用戶端某某對象方法的模板, 並格式化高亮排序後輸出內容, 就是下面本文的內容.

shawl.qiu
2006-11-20
http://blog.csdn.net/btbtd

枚舉 javascript 常用對象方法 By shawl.qiu

    linenum

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns=" http://www.w3.org/1999/xhtml">
  3. <!-- DW6 -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>shawl.qiu template</title>
  7. <script type="text/javascript">
  8. //<![CDATA[
  9.     if (navigator.appName=="Microsoft Internet Explorer") {
  10.         //已最大化的視窗
  11.         self.moveTo(-5,-5)
  12.         self.resizeTo(screen.availWidth +8,screen.availHeight+8)
  13.         //這個指令碼定義的寬度其實比原視窗還要大那麼一點.
  14.     }
  15. //]]>
  16. </script>
  17. </head>
  18. <body>
  19. 11. styleSheets<br/>
  20. <button onclick="fListMtd(styleSheets,event)">
  21. fListMtd(styleSheets)</button><br/>
  22.  
  23. 11.1 styleSheets[0]<br/>
  24. <button onclick="fListMtd(styleSheets[0],event)">
  25. fListMtd(styleSheets[0])</button><br/>
  26.  
  27. 11.1.1 styleSheets[0].rules (IE Only)<br/>
  28. <button onclick="fListMtd(styleSheets[0].rules,event)">
  29. fListMtd(styleSheets[0].rules)</button><br/>
  30.  
  31. 11.1.2 styleSheets[0].cssRules(not for IE)<br/>
  32. <button onclick="fListMtd(styleSheets[0].cssRules,event)">
  33. fListMtd(styleSheets[0].cssRules)</button><br/>
  34.  
  35. <p/>
  36.  
  37. 10. clientInformation (IE Only)<br/>
  38. <button onclick="fListMtd(clientInformation,event)">
  39. fListMtd(clientInformation)</button><br/>
  40.  
  41. <p/>
  42.  
  43. 9. style<br/>
  44. <button onclick="fListMtd(style,event)">
  45. fListMtd(style)</button><br/>
  46.  
  47. <p/>
  48.  
  49. 8. screen (IE has no details for this)<br/>
  50. <button onclick="fListMtd(screen,event)">
  51. fListMtd(screen)</button><br/>
  52.  
  53. <p/>
  54.  
  55. 7. navigator<br/>
  56. <button onclick="fListMtd(navigator,event)">
  57. fListMtd(navigator)</button><br/>
  58.  
  59. 7.1 navigator.mimeTypes (IE not support for this method)<br/>
  60. <button onclick="fListMtd(navigator.mimeTypes,event)">
  61. fListMtd(navigator.mimeTypes)</button><br/>
  62.  
  63. <p/>
  64.  
  65. 6. location<br/>
  66. <button onclick="fListMtd(location,event)">
  67. fListMtd(location)</button><br/>
  68.  
  69. <p/>
  70.  
  71. 5. images<br/>
  72. <button onclick="fListMtd(images,event)">
  73. fListMtd(images)</button><br/>
  74. 5.1 document.images[0]<br/>
  75. <button onclick="fListMtd(document.images[0],event)">
  76. fListMtd(document.images[0])</button>
  77.  
  78. <p/>
  79.  
  80. 4. history<br/>
  81. <button onclick="fListMtd(history,event)">
  82. fListMtd(history)</button>
  83.  
  84. <p/>
  85.  
  86. 3. event<br/>
  87. <button onclick="fListMtd(event,event)">
  88. fListMtd(event)</button>
  89.  
  90. <p/>
  91.  
  92. 2. form<br/>
  93. 2.1 document.forms<br/>
  94. <button onclick="fListMtd(document.forms,event)">
  95. fListMtd(document.forms)</button><br/>
  96.  
  97. 2.2 document.forms['JLKOkjk']<br/>
  98. <button onclick="fListMtd(document.forms['JLKOkjk'],event)">
  99. document.forms['JLKOkjk']</button><br/>
  100.  
  101. 2.3 document.forms['JLKOkjk'].elements<br />
  102. <button onclick="fListMtd(document.forms['JLKOkjk'].elements,event)">
  103. document.forms['JLKOkjk'].elements</button><br/>
  104.  
  105. 2.4 document.forms['JLKOkjk'].elements.childNodes<br />
  106. <button onclick="fListMtd(document.forms['JLKOkjk'].elements.childNodes,event)">
  107. document.forms['JLKOkjk'].elements.childNodes (IE Only)</button><br/>
  108.  
  109. 2.5 form file<br/>
  110. <button onclick="fListMtd(document.forms[0].file,event)">
  111. document.forms[0].file</button><br/>
  112.  
  113. 2.6 form checkbox<br/>
  114. <button onclick="fListMtd(document.getElementById('checkbox'),event)">
  115. document.getElementById('checkbox')</button><br/>
  116.  
  117. 2.7 form select<br/>
  118. <button onclick="fListMtd(document.forms['JLKOkjk'].select,event)">
  119. document.forms['JLKOkjk'].select</button><br/>
  120.  
  121. 2.8 form select options<br/>
  122. <button onclick="fListMtd(document.forms['JLKOkjk'].select.options,event)">
  123. document.forms['JLKOkjk'].select.options</button><br/>
  124.  
  125. 2.8.1 form select options[0] (Bug on Opera)<br/>
  126. <button onclick="fListMtd(document.forms['JLKOkjk'].select.options[0],event)">
  127. document.forms['JLKOkjk'].select.options[0]</button><br/>
  128.  
  129. 2.9 form textarea<br/>
  130. <button onclick="fListMtd(document.forms['JLKOkjk'].textarea,event)">
  131. document.forms['JLKOkjk'].textarea</button><br/>
  132.  
  133. <p/>
  134.  
  135. 1. document<br/>
  136. <button onclick="fListMtd(document,event)">
  137. document</button><br/>
  138.  
  139. 1.1 document.selection<br/>
  140. <button onclick="fListMtd(document.selection,event)">
  141. document.selection</button><br/>
  142.  
  143. 1.2 document.anchors<br/>
  144. <button onclick="fListMtd(document.anchors[0],event)">list document.anchors methods</button><br/>
  145.  
  146. 1.3 document.links<br/>
  147. <button onclick="fListMtd(document.links,event)">list document.links methods</button><br/>
  148.  
  149. 1.3.1 document.links[0]<br/>
  150. <button onclick="fListMtd(document.links[0],event)">list document.links[0] methods</button><br/>
  151.  
  152. 1.4 document.frames<br/>
  153. <button onclick="fListMtd(document.frames,event)">list document.frames methods</button><br/>
  154.  
  155. 1.4.1 document.frames[0]<br/>
  156. <button onclick="fListMtd(document.frames[0],event)">list document.frames[0] methods</button><br/>
  157.  
  158. 1.5 document.style<br/>
  159. <button onclick="fListMtd(style,event)">list document.style methods</button><br/>
  160.  
  161. 1.6 document.defaultView (!IE)<br/>
  162. <button onclick="fListMtd(document.defaultView,event)">list document.defaultView methods</button><br/>
  163.  
  164. 1.7 document.doctype (!IE)<br/>
  165. <button onclick="fListMtd(document.doctype,event)">list document.doctype methods</button><br/>
  166.  
  167. 1.8 document.documentElement <br/>
  168. <button onclick="fListMtd(document.documentElement,event)">list document.documentElement methods</button><br/>
  169.  
  170. 1.9 document.implementation (!IE)<br/>
  171. <button onclick="fListMtd(document.implementation,event)">list document.implementation methods</button><br/>
  172.  
  173. 1.10 document.selection <br/>
  174. <button onclick="fListMtd(document.selection,event)">list document.selection methods</button><br/>
  175.  
  176. 1.11 document.body <br/>
  177. <button onclick="fListMtd(document.body,event)">list document.body methods</button><br/>
  178.  
  179. 1.12 document.body.childNodes <br/>
  180. <button onclick="fListMtd(document.childNodes,event)">list document.childNodes methods</button><br/>
  181.  
  182. 1.12.1 document.body.childNodes[0] <br/>
  183. <button onclick="fListMtd(document.childNodes[0],event)">list document.childNodes[0] methods</button><br/>
  184.  
  185. <p/>
  186.  
  187. 0. window<br/>
  188. <button onclick="fListMtd(window,event)">
  189. fListMtd(window)</button><br/>
  190.  
  191. <p/>
  192.  
  193. <script type="text/javascript">
  194. //<![CDATA[
  195.     function fListMtd(obj, e){
  196.         if(!e)var e=window.event;
  197.         var sur=e.srcElement||e.target;
  198.         try{w.close();}catch(e){}
  199.             w=open('','newwin','width=500,height=500,left=300,top=100,scrollbars');
  200.             w.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
  201.             w.document.write('<style>body{width:400px;word-w.document.writeap: break-word;}</style>');
  202.             w.focus;
  203.             w.document.ondblclick=function(){w.close();}
  204.             fListMtd(obj, w);
  205.             w.onload=function(){ w.document.title=sur.firstChild.data;};
  206.             w.document.close();
  207.         return true;
  208.         function fListMtd(obj, target){
  209.             var ar=new Array();
  210.             var j=0;
  211.             
  212.             for(var i in obj){
  213.                 try{
  214.                     ar[j]=i.bold()+' '+(typeof obj[i]).fontcolor('red')+
  215.                     ' '+(obj[i]+'').fontcolor('blue');
  216.                     j++;
  217.                 }catch(e){
  218.                     ar[j]=i.bold()+' '+(typeof obj[i]).fontcolor('red')+
  219.                     (' empty').fontcolor('red').bold()
  220.                     j++;
  221.                 }
  222.             }
  223.             ar=ar.sort();
  224.             for(var i=0; i<ar.length; i++){
  225.                 target.document.write(i+1,'. ',ar[i],'<br/>');
  226.             }
  227.             return true;
  228.         }
  229.     } // shawl.qiu script 
  230.     onload=function(){
  231.         document.frames[0].document.write(
  232.         '<div id="t" style="border:1px dashed blue;width:50px;">just a test</div>');
  233.     }
  234. //]]>
  235. </script>
  236. <a href="/" >just a test</a><br/>
  237. <a name="test"></a>
  238. <form action="?id=test" method="post" enctype="multipart/form-data" name="form1" id="JLKOkjk">
  239.   <input type="text" name="textfield" />
  240.   <br />
  241.   <input type="checkbox" name="checkbox" value="checkbox" id="checkbox" />
  242.   <input type="checkbox" name="checkbox" value="checkbox" />
  243.   <input type="checkbox" name="checkbox" value="checkbox" onclick="" />
  244.   <br />
  245.   <p>
  246.     <label>
  247.     <input type="radio" name="RadioGroup1" value="radio" />
  248.   Radio</label>
  249.     <br />
  250.     <label>
  251.     <input type="radio" name="RadioGroup1" value="radio" />
  252.   Radio</label>
  253.     <br />
  254.     <label>
  255.     <input type="radio" name="RadioGroup1" value="radio" />
  256.   Radio</label>
  257.     <br /><br />
  258.     <input type="button" name="Button" value="Button" onclick="test(this.form, this, this.sourceIndex)"/>
  259.     <br />
  260.     <br />
  261.     <input type="file" name="file"  id="file"/>
  262.     <br />
  263.     <br />
  264.     <select name="select">
  265.         <option value="1">1</option>
  266.         <option value="2">2</option>
  267.         <option value="3">3</option>
  268.         <option value="4">4</option>
  269.         <option value="5">5</option>
  270.     </select>
  271.     <br />
  272.     <textarea name="textarea" cols="40" rows="5"></textarea>
  273.     <br />
  274.     <input type="submit" name="Submit" value="Submit" />
  275.     <input type="reset" name="Reset" value="Reset" />
  276. </p>
  277. </form>
  278. <iframe src="about:blank" width="400" height="80" id="frm"></iframe><br />
  279. <img src="images/04_1.jpg" name="image" /><br />
  280. <img src="images/gi_logo_88_31.png" width="88" height="31" name="image1" />
  281. </body>
  282. </html>


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.