var val = document.getElementById("txt1").value.replace(/[^\w\.\/]/ig, ''); 转载于:https://www.cnblogs.com/daiweixm/archive/2010/04/26/1721385.html