请大家解决这个document.getElementById无法获取的问题
就是有DIV块,想用document.getElementById获取属性失败了。详情见下:DIV块是这样的:<divid="aa"class="easyui-accor...
就是有DIV块,想用document.getElementById获取属性失败了。详情见下:
DIV块是这样的:
<div id="aa" class="easyui-accordion" style="position: absolute; top: 27px; left: 0px; right: 0px; bottom: 0px;">
<div id="bb" title="业务办理" style="overflow: auto; padding: 10px;">
...
</div>
</div>
JS代码如下:
<script type="text/javascript">
$(function(){
alert(document.getElementById("bb").title);
})
</script>
获取bb中的title获取失败,弹出一个空的框,但是改为获取.style.overflow成功弹出auto框,我怀疑是上面引用的CSS出了问题,我把class="easyui-accordion"删了,title能够获取成功,但是样式结构不一样了肯定不行。所以希望大神能帮忙找出问题在哪,在保存CSS下,可稍微修改,获取bb中的title.下面给出引用的CSS代码:
.accordion {
overflow: atuo;
border-width: 1px;
border-style: solid;
}
.accordion .accordion-header {
border-width: 0 0 1px;
cursor: pointer;
}
.accordion .accordion-body {
border-width: 0 0 1px;
}
.accordion-noborder {
border-width: 0;
}
.accordion-noborder .accordion-header {
border-width: 0 0 1px;
}
.accordion-noborder .accordion-body {
border-width: 0 0 1px;
}
.accordion-collapse {
background: url('images/accordion_arrows.png') no-repeat 0 0;
}
.accordion-expand {
background: url('images/accordion_arrows.png') no-repeat -16px 0;
}
.accordion {
background: #ffffff;
border-color: #95B8E7;
}
.accordion .accordion-header {
background: #E0ECFF;
filter: none;
}
.accordion .accordion-header-selected {
background: #FBEC88;
}
.accordion .accordion-header-selected .panel-title {
color: #000000;
}
求大神帮忙解决这个问题。 展开
DIV块是这样的:
<div id="aa" class="easyui-accordion" style="position: absolute; top: 27px; left: 0px; right: 0px; bottom: 0px;">
<div id="bb" title="业务办理" style="overflow: auto; padding: 10px;">
...
</div>
</div>
JS代码如下:
<script type="text/javascript">
$(function(){
alert(document.getElementById("bb").title);
})
</script>
获取bb中的title获取失败,弹出一个空的框,但是改为获取.style.overflow成功弹出auto框,我怀疑是上面引用的CSS出了问题,我把class="easyui-accordion"删了,title能够获取成功,但是样式结构不一样了肯定不行。所以希望大神能帮忙找出问题在哪,在保存CSS下,可稍微修改,获取bb中的title.下面给出引用的CSS代码:
.accordion {
overflow: atuo;
border-width: 1px;
border-style: solid;
}
.accordion .accordion-header {
border-width: 0 0 1px;
cursor: pointer;
}
.accordion .accordion-body {
border-width: 0 0 1px;
}
.accordion-noborder {
border-width: 0;
}
.accordion-noborder .accordion-header {
border-width: 0 0 1px;
}
.accordion-noborder .accordion-body {
border-width: 0 0 1px;
}
.accordion-collapse {
background: url('images/accordion_arrows.png') no-repeat 0 0;
}
.accordion-expand {
background: url('images/accordion_arrows.png') no-repeat -16px 0;
}
.accordion {
background: #ffffff;
border-color: #95B8E7;
}
.accordion .accordion-header {
background: #E0ECFF;
filter: none;
}
.accordion .accordion-header-selected {
background: #FBEC88;
}
.accordion .accordion-header-selected .panel-title {
color: #000000;
}
求大神帮忙解决这个问题。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询