function replacedou(s)
{
var i;
var s2 = s.value;
while(s2.indexOf(",")>0)
{
i = s2.indexOf(",");
s2 = s2.substring(0, i) + "|" + s2.substring(i + 1, s2.length);
} s.value=s2; } <input type=text name="AC" value="" onChange="return replacedou(this);">
<input type=text name="AB" value="" onChange="return replacedou(this)">
{
var i;
var s2 = s.value;
while(s2.indexOf(",")>0)
{
i = s2.indexOf(",");
s2 = s2.substring(0, i) + "|" + s2.substring(i + 1, s2.length);
} s.value=s2; } <input type=text name="AC" value="" onChange="return replacedou(this);">
<input type=text name="AB" value="" onChange="return replacedou(this)">
// 作用是把字符中的 "," 换成 "|"
function replacedou(s)
{
var i;
var s2 = s;
while(s2.indexOf(",")>0)
{
i = s2.indexOf(",");
s2 = s2.substring(0, i) + "|" + s2.substring(i + 1, s2.length);
}
return s2;
} </script> <form name="form">
<input type=text name="AC" value="" onkeyup="document.all.AC.value = replacedou(this.value)">
<input type=text name="AB" value="" onkeyup="document.all.AB.value = replacedou(this.value)">
<input type=submit>
</form>
2、onChange="return replacedou(this.value);"的写法有问题
你使用return把结果返回到那里去了呢?
应写做this.value=replacedou(this.value);