通过document.getElementById()或ByName取得的dom元素,在safari下不能得到其自定义属性值
如:
<select id="l" extraInfo="default" οnchange="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能解决
如:
<select id="l" extraInfo="default" οnchange="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能解决