标签存档: css js

Html元素引起多次加载页面的问题分析

一、Button元素

button各个浏览器的表现,在w3c中,标准的button,其type是submit,等效于<input type=”submit” value=”xxx”/>

浏览器 type 行为 解决办法
Firefox submit 会提交表单 指定type
chrome submit 会提交表单 指定type
ie6 button 不会提交表单  
ie7 button 不会提交表单  
ie8 submit 会提交表单
  1. 当指定type为button时,则可以避免误用button。 如 <button type=”button” onclick=”dosomething();”>我不是提交</button>。
  2. 可以在onclick事件添加return false;避免提交, 如 <button onclick=”dosomething(); return false;”>我不是提交</button>。
  3. 通过在页面head处添加页面以ie7兼容模式查看,也可解决<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />
ie9 submit(未测) 会提交(未测) ie9不支持xp,暂时无法测试,其号称是支持标准最规范,那么其默认是submit

继续阅读 »