str.replace(/200/,'300').replace(/500/,'600')

解决方案 »

  1.   

    var sre="http://localhost/shop/pbC1/C310/B288/p200t500.shtml";
    sre=sre.replace(/200/,"300");
    sre=sre.replace(/500/,"600");
    alert(sre);
      

  2.   

    function bb(){
    var oUrl = "http://localhost/shop/pbC1/C310/B288/p200t500.shtml";
    var aa=oUrl.split("/");
    var nUrl="";
    for(i=0;i<7;i++){
    nUrl+=aa[i]+"/";
    }
    nUrl+="p"+300+"t"+600+".shtml"
    alert(nUrl);
    this.location = nUrl;
    }
      

  3.   

     var sre="http://localhost/shop/pbC1/C310/B288/p200t500.shtml";
        sre=sre.replace(/200/,"300");
        sre=sre.replace(/500/,"600");
        alert(sre);