上代码...请问我 document.getElementByName("show")可以取到c标签对吧 但现在我想取a标签的style元素的值 我ok方法应该怎么写 <c id =<%= i%> name="show">
<b id=<%=m%>>
<a href="#" style="abc">
</a>
</b>
</c><script type=text/javascript>
function ok() {
document.getElementByName("show"). }
</script>
<b id=<%=m%>>
<a href="#" style="abc">
</a>
</b>
</c><script type=text/javascript>
function ok() {
document.getElementByName("show"). }
</script>
document.getElementById("a1").style.display = 'none';
document.getElementByName("show")[0].style
}style是个对象访问他的属性可以 xx.style.width 这个样子
我javascrpt里声明
var obj =""
function ok() {
alert("sadasd");
obj=document.getElementsByName("show")[0].getElementsByTagName("a")[0].getAttribute('style');
alert(obj); }出错 alert弹不出来 对象应该没取到 你再给看看把
<c name="show">
<b>
<a href="#" style="abc">
</a>
</b>
</c><script type=text/javascript>
function ok() {
obj=document.getElementsByName("show")[0].getElementsByTagName("a")[0].getAttribute('style');
alert(obj);
}
ok()
</script>