<script>
 function renc(obj, reg, inputStr)
 {
  var docSel = document.selection.createRange()
  if (docSel.parentElement().tagName != "INPUT") return false
  oSel = docSel.duplicate()
  oSel.text = ""
  var srcRange = obj.createTextRange()
  oSel.setEndPoint("StartToStart", srcRange)
  var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
  return reg.test(str)
 }
</script>
<input onkeypress ="return renc(this,/^[^']*$/,String.fromCharCode(event.keyCode))" onpaste="return renc(this,/^[^']*$/,window.clipboardData.getData('Text'))" ondrop="return renc(this,/^[^']*$/,event.dataTransfer.getData('Text'))">

相关文章:

  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2021-08-01
  • 2022-03-01
  • 2021-09-08
  • 2021-11-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案