Tag: javascript

  • Role transition to a Frontend Developer

    Role transition to a Frontend Developer

    There are only two hard problems in Computer Science: cache invalidation and naming things. Phil Karlton I recently started a frontend role at Automattic. Just in case any of you still don’t know the company, it’s the company behind WordPress.com, Tumblr, Simplenote etc. Developers at A8C are all kinda full stack engineers. I was mostly […]

  • js限制用户输入为数字、字母、中文

    利用正则表达式限制网页表单里的文本框输入内容: 用正则表达式限制只能输入中文:onkeyup=”value=value.replace(/[^u4E00-u9FA5]/g,”)” onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^u4E00-u9FA5]/g,”))” 用正则表达式限制只能输入全角字符: onkeyup=”value=value.replace(/[^uFF00-uFFFF]/g,”)” onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^uFF00-uFFFF]/g,”))” 用正则表达式限制只能输入数字:onkeyup=”value=value.replace(/[^d]/g,”) “onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^d]/g,”))” 用正则表达式限制只能输入数字和英文:onkeyup=”value=value.replace(/[W]/g,”) “onbeforepaste=”clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^d]/g,”))” --不知道什么高人写的,真不错