日期:2014-05-16 浏览次数:20339 次
<input id='i' value='1|2|3|4|5|'/> <input type='button' value='b1' onclick='delstr("1|")'/> <input type='button' value='b2' onclick='delstr("2|")'/> <input type='button' value='b3' onclick='delstr("3|")'/> <input type='button' value='b4' onclick='delstr("4|")'/> <input type='button' value='b5' onclick='delstr("5|")'/> <script language="javascript" type="text/javascript"> function delstr(str) { var regex = new RegExp(str.replace('\|','\\\|')); var ipt = document.getElementById('i'); ipt.value = ipt.value.replace(regex,''); } </script>