首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

document.getElementById("div"+i).style.display = "bl在chrome中 不能用?

2012-09-10 
document.getElementById(div+i).style.display bl在chrome中 不能用?JScript codedocument.getEleme

document.getElementById("div"+i).style.display = "bl在chrome中 不能用?

JScript code
document.getElementById("div"+i).style.display = "block";


这个在ie中正常 但是在chrome下 无效


[解决办法]
w3c标准的浏览器自定义属性要使用getAttribute获取
JScript code
function yc_xs(o) {        var btn = o.value; ////var j = o.j;  var j = o.getAttribute('j');      //////////        if (btn == "显示答案") {            document.getElementById(o.id).value = "隐藏答案";            document.getElementById("div" + j).style.display = "block";        } else {            document.getElementById(o.id).value = "显示答案";            document.getElementById("div" + j).style.display = "none";        } } 

热点排行