onclick="activation('话费_400')"function activation(msg)
{
  alert(rep(msg))
}
function rep(str)
{
  var s
  s = str.replace("话费","HF")
  return (s)
}
请问下我这段JS为什么不能成功运行

解决方案 »

  1.   


    <script type="text/javascript"> 
    function activation(msg) 

      alert(rep(msg)) 

    function rep(str) 

      var s 
      s = str.replace(/话费/g,"HF") 
      return (s) 

    </script> <input type="button" onclick="activation('话费_400')">
      

  2.   


    onclick="activation('话费_400')" 
    function activation(msg) 

      alert(rep(msg)) ;

    function rep(str) 

      var s ;
      s = str.replace("话费","HF") ;
      return (s) ;
    } 加上;号就可以了。
      

  3.   

    http://wangyi878750.blog.sohu.com/31370032.html