当前位置: 代码迷 >> Web前端 >> safari对自定义标签跟自定义标签属性的处理
  详细解决方案

safari对自定义标签跟自定义标签属性的处理

热度:28   发布时间:2012-11-03 10:57:42.0
safari对自定义标签和自定义标签属性的处理
通过document.getElementById()或ByName取得的dom元素,在safari下不能得到其自定义属性值
如:
<select id="l" extraInfo="default" onchange="c()">
<option value="1" e="he">hi</option>
<option value="2" e="hee">hii</option>
<option value="3" e="heee">hiii</option>
<option value="4" e="heeee">hiiii</option>
</select>

脚本:  function c(){ 
              alert("first select");
if(window.openDatabase){
alert("*****safari*****");
}else{
  alert("*****IE*****");
}
alert($("#l").attr("extraInfo"));
alert($("#l option:selected").attr("e"));
var ss=document.getElementById("l").extraInfo;
alert("doc****"+ss);
}
这种情况用JQuery能解决