<html>
<head>
<script language=javascript>
function a(){
var o=document.getElementById("num");
var t=o.value.replace(/“|”/g,"\"");
o.value=t;
alert(t);
}
</script>
</head>
<body>
<input type=text id="num" ><input type=button value="replace" onclick="a();"></body>
</html>

解决方案 »

  1.   

    joohnnie的是正确的,我估计lz需要调整下编码。
      

  2.   

    The statement “__________”can not be ...
    以前自己写的脚本都不用了,现在照抄joohnnie的,但这段文本总是无法替换掉。这是部分脚本
    function CheckForm(thisForm)
    {
    if( thisForm.Question.value=='')   
      {
       thisForm.Question.focus();   
        alert("Plese enter Question!");   
        return   false;   
      }  
      else
       {
       ReplaceStr("Question");
       }
      return   true;
    }  
    //replace 
    function ReplaceStr(elementID)
    {
      
      
       var o=document.getElementById(elementID);
      var t=o.value.replace(/“|”/g,"\"");
      o.value=t;
      alert(t);  
      
    }
      

  3.   

    可以替换,是我的问题,不知啥时候把form删掉了,但脚本怎么还能执行,所以没注意到。
    下面要解决显示引号的问题了