表单事件,onblur,onfocus,焦点
2016-04-15 10:43
423 查看
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>表单事件</title> <script type="text/javascript"> //表单焦点失去、获得 onload = function () { var txt = document.getElementById("txt"); txt.onblur = function () { if (txt.value == "") { txt.value = "如123abc@163.com"; } } txt.onfocus = function () { if (txt.value == "如123abc@163.com") { txt.value = ""; } } } </script> </head> <body> <form id="fm"> <!--有时提交会出现405错误,可能与name,value,id有关--> <input type="text" name="uid" value="" id="txt" /><br /> <input type="password" name="pwd" value="" /><br /> <input type="submit" value="提交" id="btn1" /><br /> </form> </body> </html>
相关文章推荐
- 链表
- Centos 6.5 安装oracle
- SpatialHadoop:有效的分析你的空间数据
- java中的23种设计模式
- 2016.04.15
- TP下的session.memcache
- Hash概率问题
- Java技术晋升之路
- jQuery冒泡事件阻止
- 复利计算器评论
- Linux使用笔记
- 二叉树层次遍历
- C#+ AE 注意问题汇总(不断更新)
- MFC线程编程
- 插入排序
- 解决org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localSessi
- mybatis缓存
- EditPlus配置C#编译及运行环境
- 计算出字符串中出现次数最多的字符是什么,出现了多少次
- 张孝祥Java面试宝典学习笔记---软件工程与设计模式(23种)