<div id="fenye">[1]&nbsp;
<a href="tie-----2.html">[2]</a>&nbsp;
<a href="tie-----3.html">[3]</a>&nbsp;
<a href="tie-----4.html">[4]</a>&nbsp;
<a href="tie-----5.html">[5]</a>&nbsp;
<a href="tie-----6.html">[6]</a>&nbsp;
<a href="tie-----7.html">[7]</a>&nbsp;
</div>
——————————————————————————————
在上面这个div id=fenye的对象中的所有链接里面,每个对象被点击后,他的会自动跳转到这个链接的地址+"?kw=%ADBADFA%"比如点击<a href="tie-----2.html">[2]</a>&nbsp
他会跳转到tie-----2.html?kw=...这个网址,而不是tie-----2.html,
怎么弄啊,用JavaScript。

解决方案 »

  1.   


    <script>
    window.onload=function(){
       var div = document.getElementById("fenye");
       var a = div.getElementsByTagName("A");
       for(var i=0;i<a.length;i++){
         a[i].href += "?kw=%ADBADFA%";
       }
    }
    </script>
    <div id="fenye">[1]&nbsp; 
    <a href="tie-----2.html">[2] </a>&nbsp; 
    <a href="tie-----3.html">[3] </a>&nbsp; 
    <a href="tie-----4.html">[4] </a>&nbsp; 
    <a href="tie-----5.html">[5] </a>&nbsp; 
    <a href="tie-----6.html">[6] </a>&nbsp; 
    <a href="tie-----7.html">[7] </a>&nbsp; 
    </div>