onclick="activation('话费_400')"function activation(msg)
{
alert(rep(msg))
}
function rep(str)
{
var s
s = str.replace("话费","HF")
return (s)
}
请问下我这段JS为什么不能成功运行
{
alert(rep(msg))
}
function rep(str)
{
var s
s = str.replace("话费","HF")
return (s)
}
请问下我这段JS为什么不能成功运行
<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')">
onclick="activation('话费_400')"
function activation(msg)
{
alert(rep(msg)) ;
}
function rep(str)
{
var s ;
s = str.replace("话费","HF") ;
return (s) ;
} 加上;号就可以了。