onsubmit,onload事件触发,行为结构相分离
2016-04-14 00:00
302 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>新建网页</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="布尔教育 http://www.itbool.com" /> </head> <body> <form action="m9.php" onsubmit="return t1()"> <p><input type="text" /></p> <p><input type="text" /></p> <p><input type="submit" value="提交"/></p> </form> </body> <script> // 注意在onsubmit提交触发时,有点特殊 function t1 () { // body... alert("请填写完整"); return false; } </script> </html> /******************************** *行为ie结构相分离********/ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>新建网页</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="布尔教育 http://www.itbool.com" /> <style> #div{ width: 200px; height: 200px; } </style> </head> <body> <p>行为,结构相分离</p> <div> <ul> <li>好</li> </ul> </div> </body> <script> // 行为,结构相分离 document.getElementsByTagName('div')[0].onclick=function () { this.style.border="1px solid blue"; // body... } </script> </html>
相关文章推荐
- 事件委托,target实现下象棋
- tomcat多端口多路径配置
- 一次CMS GC问题排查过程(理解原理+读懂GC日志)
- elasticsearch 集群搭建
- elasticsearch 快照及从快照中恢复数据
- C++获得vector最后一个元素
- Hibernate各种主键生成策略与配置详解
- VIEWGOOD(远古)图书馆的资源融合与共享应用解决方案
- CentOS6.5安装Docker
- curl笔记
- 计算两个日期相差几个月
- centos 挂载与卸载硬盘
- 【BoneCP】 com.jolbox.bonecp.BoneCP - Unable to star
- 查看某个进程执行的线程数
- 如何设置Session的有效期?
- 问题解决:The project cannot be built until build path
- POI的简单使用
- mongo-java-driver 的复杂查询
- 快速排序
- 直接选择排序