还有就是如何定义一段区域给它个id而后可以用document.all.id.value=""对它赋值,但看到的效果象document.write()的一样?

解决方案 »

  1.   


    <script>
    function ReplaceDemo(a){   var r, re;                    // 声明变量。
       var ss = "The man hit the ball with the bat.\n";
       ss += "while the fielder caught the ball with the glove.";
       re = /The/g;             // 创建正则表达式模式。
       r = ss.replace(re, a);    // 用 "A" 替换 "The"。
       return(r);                   // 返回替换后的字符串。
    }
    alert(ReplaceDemo("fdsafdasfdsafdsa"));
    </script>
      

  2.   

    还有就是如何定义一段区域给它个id而后可以用document.all.id.value=""对它赋值,但看到的效果象document.write()的一样?
    document.all.id.innerHTML ="<a..........
      

  3.   

    还有就是如何定义一段区域给它个id而后可以用document.all.id.value=""对它赋值,但看到的效果象document.write()的一样?
    ----------------------------------------------<font id=hello>aaa</font><br>
    <input type=button value=方式1 onclick="hello.innerText='fdsafdas'"><br>
    <input type=button value=方式1 onclick="hello.innerHTML='<b>fdsafdas</b>'"><br>
      

  4.   

    关于innerHTML已经成功了,谢谢大家~~~~~~
    replace还不会,怎样用变量代替
    re = /The/g; 的“The”?
      

  5.   

    eval("re=/" + variable + "/g");