{"id":673,"date":"2011-01-28T09:58:49","date_gmt":"2011-01-28T01:58:49","guid":{"rendered":""},"modified":"2014-03-11T22:36:22","modified_gmt":"2014-03-11T14:36:22","slug":"%e6%94%af%e6%8c%81firefox-javascript-%e6%b7%bb%e5%8a%a0%e5%88%a0%e9%99%a4%e8%a1%a8%e6%a0%bc","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2011\/01\/28\/673.htm","title":{"rendered":"\u652f\u6301firefox javascript \u6dfb\u52a0\u5220\u9664\u8868\u683c"},"content":{"rendered":"<p>&lt;div&gt;<br \/>\n&lt;table width=&quot;613&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; id=&quot;SignFrame&quot;&gt;<br \/>\n&lt;tr id=&quot;trHeader&quot;&gt;<br \/>\n&lt;td width=&quot;27&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u5e8f\u53f7&lt;\/td&gt;<br \/>\n&lt;td width=&quot;64&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u7528\u6237\u59d3\u540d&lt;\/td&gt;<br \/>\n&lt;td width=&quot;98&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u7535\u5b50\u90ae\u7bb1&lt;\/td&gt;<br \/>\n&lt;td width=&quot;92&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u56fa\u5b9a\u7535\u8bdd&lt;\/td&gt;<br \/>\n&lt;td width=&quot;86&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u79fb\u52a8\u624b\u673a&lt;\/td&gt;<br \/>\n&lt;td width=&quot;153&quot; bgcolor=&quot;#96E0E2&quot;&gt;\u516c\u53f8\u540d\u79f0&lt;\/td&gt;<br \/>\n&lt;td width=&quot;57&quot; align=&quot;center&quot; bgcolor=&quot;#96E0E2&quot;&gt;&amp;nbsp;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/table&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div&gt;<br \/>\n&lt;input type=&quot;button&quot; name=&quot;Submit&quot; value=&quot;\u6dfb\u52a0\u53c2\u4e0e\u4eba&quot; onclick=&quot;AddSignRow()&quot; \/&gt;<br \/>\n&lt;input type=&quot;button&quot; name=&quot;Submit2&quot; value=&quot;\u6e05\u7a7a&quot; onclick=&quot;ClearAllSign()&quot; \/&gt;<br \/>\n&lt;input name=&#8217;txtTRLastIndex&#8217; type=&#8217;hidden&#8217; id=&#8217;txtTRLastIndex&#8217; value=&quot;1&quot; \/&gt;<br \/>\n&lt;\/div&gt;<br \/>\nJS\u4ee3\u7801\u90e8\u4efd<br \/>\n&lt;script language=&quot;javascript&quot;&gt;<br \/>\n\/\/ Example: obj = findObj(&quot;image1&quot;);<br \/>\nfunction findObj(theObj, theDoc)<br \/>\n{<br \/>\nvar p, i, foundObj;<\/p>\n<p>if(!theDoc) theDoc = document;<br \/>\nif( (p = theObj.indexOf(&quot;?&quot;)) &gt; 0 &amp;&amp; parent.frames.length)<br \/>\n{<br \/>\ntheDoc = parent.frames[theObj.substring(p+1)].document;<br \/>\ntheObj = theObj.substring(0,p);<br \/>\n}<br \/>\nif(!(foundObj = theDoc[theObj]) &amp;&amp; theDoc.all) foundObj = theDoc.all[theObj];<br \/>\nfor (i=0; !foundObj &amp;&amp; i &lt; theDoc.forms.length; i++)<br \/>\nfoundObj = theDoc.forms[theObj];<br \/>\nfor(i=0; !foundObj &amp;&amp; theDoc.layers &amp;&amp; i &lt; theDoc.layers.length; i++)<br \/>\nfoundObj = findObj(theObj,theDoc.layers.document);<br \/>\nif(!foundObj &amp;&amp; document.getElementById) foundObj = document.getElementById(theObj);<\/p>\n<p>return foundObj;<br \/>\n}<\/p>\n<p>\n&nbsp;<\/p>\n<p>\/\/\u6dfb\u52a0\u4e00\u4e2a\u53c2\u4e0e\u4eba\u586b\u5199\u884c<br \/>\nfunction AddSignRow(){<br \/>\n\/\/\u8bfb\u53d6\u6700\u540e\u4e00\u884c\u7684\u884c\u53f7\uff0c\u5b58\u653e\u5728txtTRLastIndex\u6587\u672c\u6846\u4e2d <br \/>\nvar txtTRLastIndex = findObj(&quot;txtTRLastIndex&quot;,document);<br \/>\nvar rowID = parseInt(txtTRLastIndex.value);<\/p>\n<p>var signFrame = findObj(&quot;SignFrame&quot;,document);<br \/>\n\/\/\u6dfb\u52a0\u884c<br \/>\nvar newTR = signFrame.insertRow(signFrame.rows.length);<br \/>\nnewTR.id = &quot;SignItem&quot; + rowID;<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u5e8f\u53f7<br \/>\nvar newNameTD=newTR.insertCell(0);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewNameTD.innerHTML = newTR.rowIndex.toString();<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u59d3\u540d<br \/>\nvar newNameTD=newTR.insertCell(1);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewNameTD.innerHTML = &quot;&lt;input name=&#8217;txtName&quot; + rowID + &quot;&#8217; id=&#8217;txtName&quot; + rowID + &quot;&#8217; type=&#8217;text&#8217; size=&#8217;12&#8217; \/&gt;&quot;;<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u7535\u5b50\u90ae\u7bb1<br \/>\nvar newEmailTD=newTR.insertCell(2);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewEmailTD.innerHTML = &quot;&lt;input name=&#8217;txtEMail&quot; + rowID + &quot;&#8217; id=&#8217;txtEmail&quot; + rowID + &quot;&#8217; type=&#8217;text&#8217; size=&#8217;20&#8217; \/&gt;&quot;;<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u7535\u8bdd<br \/>\nvar newTelTD=newTR.insertCell(3);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewTelTD.innerHTML = &quot;&lt;input name=&#8217;txtTel&quot; + rowID + &quot;&#8217; id=&#8217;txtTel&quot; + rowID + &quot;&#8217; type=&#8217;text&#8217; size=&#8217;10&#8217; \/&gt;&quot;;<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u624b\u673a<br \/>\nvar newMobileTD=newTR.insertCell(4);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewMobileTD.innerHTML = &quot;&lt;input name=&#8217;txtMobile&quot; + rowID + &quot;&#8217; id=&#8217;txtMobile&quot; + rowID + &quot;&#8217; type=&#8217;text&#8217; size=&#8217;12&#8217; \/&gt;&quot;;<\/p>\n<p>\/\/\u6dfb\u52a0\u5217:\u516c\u53f8\u540d<br \/>\nvar newCompanyTD=newTR.insertCell(5);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewCompanyTD.innerHTML = &quot;&lt;input name=&#8217;txtCompany&quot; + rowID + &quot;&#8217; id=&#8217;txtCompany&quot; + rowID + &quot;&#8217; type=&#8217;text&#8217; size=&#8217;20&#8217; \/&gt;&quot;;<\/p>\n<p>\n\/\/\u6dfb\u52a0\u5217:\u5220\u9664\u6309\u94ae<br \/>\nvar newDeleteTD=newTR.insertCell(6);<br \/>\n\/\/\u6dfb\u52a0\u5217\u5185\u5bb9<br \/>\nnewDeleteTD.innerHTML = &quot;&lt;div align=&#8217;center&#8217; style=&#8217;width:40px&#8217;&gt;&lt;a href=&#8217;javascript:;&#8217; onclick=\\&quot;DeleteSignRow(&#8216;SignItem&quot; + rowID + &quot;&#8217;)\\&quot;&gt;\u5220\u9664&lt;\/a&gt;&lt;\/div&gt;&quot;;<\/p>\n<p>\/\/\u5c06\u884c\u53f7\u63a8\u8fdb\u4e0b\u4e00\u884c<br \/>\ntxtTRLastIndex.value = (rowID + 1).toString() ;<br \/>\n}<\/p>\n<p>\n&nbsp;<\/p>\n<p>\/\/\u5220\u9664\u6307\u5b9a\u884c<br \/>\nfunction DeleteSignRow(rowid){<br \/>\nvar signFrame = findObj(&quot;SignFrame&quot;,document);<br \/>\nvar signItem = findObj(rowid,document);<\/p>\n<p>\/\/\u83b7\u53d6\u5c06\u8981\u5220\u9664\u7684\u884c\u7684Index<br \/>\nvar rowIndex = signItem.rowIndex;<\/p>\n<p>\/\/\u5220\u9664\u6307\u5b9aIndex\u7684\u884c<br \/>\nsignFrame.deleteRow(rowIndex);<\/p>\n<p>\/\/\u91cd\u65b0\u6392\u5217\u5e8f\u53f7\uff0c\u5982\u679c\u6ca1\u6709\u5e8f\u53f7\uff0c\u8fd9\u4e00\u6b65\u7701\u7565<br \/>\nfor(i=rowIndex;i&lt;signFrame.rows.length;i++){<br \/>\nsignFrame.rows.cells[0].innerHTML = i.toString();<br \/>\n}<br \/>\n}<br \/>\n\/\/\u6e05\u7a7a\u5217\u8868<br \/>\nfunction ClearAllSign(){<br \/>\nif(confirm(&#8216;\u786e\u5b9a\u8981\u6e05\u7a7a\u6240\u6709\u53c2\u4e0e\u4eba\u5417\uff1f&#8217;)){<br \/>\nvar signFrame = findObj(&quot;SignFrame&quot;,document);<br \/>\nvar rowscount = signFrame.rows.length;<\/p>\n<p>\/\/\u5faa\u73af\u5220\u9664\u884c,\u4ece\u6700\u540e\u4e00\u884c\u5f80\u524d\u5220\u9664<br \/>\nfor(i=rowscount &#8211; 1;i &gt; 0; i&#8211;){<br \/>\nsignFrame.deleteRow(i);<br \/>\n}<\/p>\n<p>\/\/\u91cd\u7f6e\u6700\u540e\u884c\u53f7\u4e3a1<br \/>\nvar txtTRLastIndex = findObj(&quot;txtTRLastIndex&quot;,document);<br \/>\ntxtTRLastIndex.value = &quot;1&quot;;<\/p>\n<p>\/\/\u9884\u6dfb\u52a0\u4e00\u884c<br \/>\nAddSignRow();<br \/>\n}<br \/>\n}<\/p>\n<p>\n&nbsp;<\/p>\n<p>&lt;\/script<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;div&gt; &lt;table width=&quot;613&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; id=&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-673","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=673"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":66531,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/673\/revisions\/66531"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=673"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}