JavaScript restricts the form from entering illegal characters

From , 3 Years ago, written in JavaScript, viewed 96 times.
URL https://pastebin.vip/view/22866910
  1. <script language="javascript">
  2. <!--
  3.  
  4. function contain(str,charset)// 字符串包含测试函数
  5. {
  6. var i;
  7. for(i=0;i<charset.length;i++)
  8. if(str.indexOf(charset.charAt(i))>=0)
  9. return true;
  10. return false;
  11. }
  12.  
  13. function CheckForm()
  14. {
  15. if ((contain(document.form.NAME.value, "%\(\)><")) || (contain(document.form.MESSAGE.value, "%\(\)><")))
  16. {
  17. alert("输入了非法字符");
  18. document.form.NAME.focus();
  19. return false;
  20. }
  21. return true;
  22. }
  23. //-->
  24. </script>
  25. //javascript/263

Reply to "JavaScript restricts the form from entering illegal characters"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website