首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • JS字符替换问题 [已结贴,结贴人:hnsongbiao]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • hnsongbiao
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    • 揭帖率:
    发表于:2008-08-19 14:41:17 楼主
    <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>>

    先要求用JS 替换上面的ShowClass为ShowWzClass

    50  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • sd5816690
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 14:48:461楼 得分:20
    HTML code
    <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>
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • weixinpeng
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 14:53:582楼 得分:0
    <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>

    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • weixinpeng
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 14:54:303楼 得分:0
    楼上的楼上 正解  支持
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • fengyun817
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 14:54:534楼 得分:30

    JScript code
    window.onload=function(){ document.all.ware_right_10.innerHTML=document.all.ware_right_10.innerHTML.replace(/ShowClass/gi,'ShowWzClass'); }
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • orz_ORZ_orz
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 14:55:195楼 得分:0
    <script>
    var b=document.getElementById("ware_right_10").innerHTML;

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

    alert(c);
    </script>
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • hnsongbiao
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-08-19 15:34:216楼 得分:0
    如果将一个页面中的字符全部替换怎么做呢?

    如将页面中的 ShowClass.asp 全部替换为ShowWzClass.asp

    应该怎么实现?
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved