<html> 
<head>
<title></title> 
<script>
window.onload = function(){
div2.innerHTML = div1.innerHTML.replace(/ShowClass/g,"ShowWzClass");
}
</script>
</head> 
<body>
替换前:
<div id="div1">
<xmp>
<DIV id=ware_right_10> <div class="show_page">共 <b>300 </b> 个商品&nbsp;&nbsp;&nbsp;首页 | 上一页 | <font color="FF0000">1 </font> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=2">2 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=3">3 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=4">4 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=5">5 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=6">6 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=7">7 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=8">8 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=9">9 </a>  | <a href='/YLcn/Shop/ShowClass.asp?ClassID=1&page=2'>下一页 </a> | <a href='/YLcn/Shop/ShowClass.asp?ClassID=1&page=11'>  尾页 </a>&nbsp; <b>28 </b>个商品/页&nbsp;&nbsp;转到第 <Input type='text' name='page' size='3' maxlength='5' value='1' onKeyPress="if (event.keyCode==13) window.location='/YLcn/Shop/ShowClass.asp?ClassID=1&page='+this.value;">页 </div> </DIV>>
</xmp>
</div>替换后:
<div id="div2"></div>
</body>
</html> 

解决方案 »

  1.   

    <html> 
    <head>
    <title></title> 
    <script>
    window.onload = function(){
        div2.innerHTML = div1.innerHTML.replace(/ShowClass/g,"ShowWzClass");
    }
    </script>
    </head> 
    <body>
    替换前:
    <div id="div1">
    <xmp>
    <DIV id=ware_right_10> <div class="show_page">共 <b>300 </b> 个商品&nbsp;&nbsp;&nbsp;首页 | 上一页 | <font color="FF0000">1 </font> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=2">2 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=3">3 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=4">4 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=5">5 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=6">6 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=7">7 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=8">8 </a> <a href="/YLcn/Shop/ShowClass.asp?ClassID=1&page=9">9 </a>  | <a href='/YLcn/Shop/ShowClass.asp?ClassID=1&page=2'>下一页 </a> | <a href='/YLcn/Shop/ShowClass.asp?ClassID=1&page=11'>  尾页 </a>&nbsp; <b>28 </b>个商品/页&nbsp;&nbsp;转到第 <Input type='text' name='page' size='3' maxlength='5' value='1' onKeyPress="if (event.keyCode==13) window.location='/YLcn/Shop/ShowClass.asp?ClassID=1&page='+this.value;">页 </div> </DIV>>
    </xmp>
    </div>替换后:
    <div id="div2"></div>
    </body>
    </html> 
      

  2.   

      window.onload=function(){
        document.all.ware_right_10.innerHTML=document.all.ware_right_10.innerHTML.replace(/ShowClass/gi,'ShowWzClass');
      }
      

  3.   

    <script>
    var b=document.getElementById("ware_right_10").innerHTML;

    var c=b.replace(/ShowClass/gi,"ShowWzClass");

    alert(c);
    </script>
      

  4.   

    如果将一个页面中的字符全部替换怎么做呢?如将页面中的 ShowClass.asp 全部替换为ShowWzClass.asp应该怎么实现?