<input type="text" id="txt">
<input type="button" onClick="check(document.getElementById('txt').value);" value="验证">
<script>
   function check(str){
      var reg=/[/<>\|']/g;
      if(reg.test(str)){
         alert("您输入的值包含/<>|'");
         return true;
      }else {
         alert("您输入的值不包含/<>|'");
         return false;
      }
   }
</script>