本帖最后由 CrLf 于 2015-8-11 21:45 编辑
举个腻子:- <input id=pw type=password />
- <script>
- document.onkeypress=doKey
-
- function doKey(e){
- var ev = e || window.event
- var obj = ev.target || ev.srcElement
- var t = obj.type || obj.getAttribute('type')
- if(ev.keyCode == 13 && (t == "password" || t == "text" || t == "textarea")){
- check(obj.value)
- }
- }
-
- function check(password){
- if(password=='bathome'){
- alert('嚯哈哈哈哈哈哈哈哈哈,青山不改绿水长流,少侠就此别过')
- window.close()
- }else{
- alert('渣渣,密码不对')
- }
- }
- </script>
复制代码 然并卵 |