<title>無標(biāo)題文檔</title><script type="text/javascript">function showResult(){//顯示提交結(jié)果var msg = get(p1());alert(msg);}function p1(){var ps,i;ps=document.all.tags(getHtml(likes));document.writeln("本文檔含有"+ps.length+"個(gè)"+x+"標(biāo)簽對(duì)");if(ps.length>0);for(i=1;i<=ps.length;i++)document.writeln("第"+i+"標(biāo)簽對(duì)之間的內(nèi)容為:"+ps[i-1].innerText);}function getHtml(likes){//獲取愛好var i,result="";for(i=0;i<likes.length;i++){if(likes.options[i].selected) result = likes.options[i].text;}return result;}</script></head><body><p>tags Method retrieves a collection of <a href="../綜合題(1).html">objects</a> that have the specified HTML tag name. </p><p>collElements = object.tags(sTag)</p><p>sTag specifies an <a href="../綜合題(3).html">HTML</a> tag. It can be any one of the objects exposed by the DHTML Object Model. </p><form name="get"><p> 請(qǐng)輸入所要查詢的HTML標(biāo)簽:<select name="likes" size="1" multiple="multiple" ><option value="1">P</option><option value="2">A</option><option value="3">H</option></select><input type="submit" name="Button1" value="提交" onclick="showResult()" /></p></form></body></html>
1 回答

慕的地6264312
TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
各種錯(cuò)啊親
最大的錯(cuò)誤是,你的button不應(yīng)該是submit類型的
每次點(diǎn)擊都等于刷新界面啊
如果你真想實(shí)現(xiàn)url中帶參數(shù)
那應(yīng)該在頁(yè)面最后再執(zhí)行你的showResult方法,不然dom還沒加載完,怎么可能有元素
添加回答
舉報(bào)
0/150
提交
取消