很郁闷,关于style.display的问题
<input id=ipt1 NAME= "ipt1 "> <input id=ipt2 NAME= "ipt2 "> <input id=ipt3 NAME= "ipt3 ">
<input type=button onclick=doit() value=doit>
<script>
function doit()
{
ipt1.style.display = "none ";
ipt2.style.display = "none ";
ipt3.style.display = "none ";
ipt1.style.display = "block ";
ipt2.style.display = "block ";
ipt3.style.display = "block ";
}
</script>
本来是连着的3个input,一按就变不同行了,大家看看怎么解决.
------解决方案--------------------不知道你代码为了实现什么效果;
在display的取值中,block的说明如下:
------------------------------------------
block : CSS1 块对象的默认值。用该值为对象之后添加新行
------解决方案--------------------呵呵,早上才给同事看到个这问题,直接用id.style.display= " ";(显示)
id.style.display= "none ";(不显示)
------解决方案--------------------function doit() {
document.all.ipt1.style.display = document.all.ipt1.style.display!= "none "? "none ": " ";
document.all.ipt2.style.display = document.all.ipt2.style.display!= "none "? "none ": " ";
document.all.ipt3.style.display = document.all.ipt3.style.display!= "none "? "none ": " ";
}
------解决方案--------------------百度一下
网页制作完全手册
------解决方案--------------------JF
------解决方案-------------------- <input id=ipt1 NAME= "ipt1 "> <input id=ipt2 NAME= "ipt2 "> <input id=ipt3 NAME= "ipt3 ">
<input type=button onclick=doit() value=doit>
<script>
function doit()
{
ipt1.style.display = " ";
ipt2.style.display = " ";
ipt3.style.display = " ";
ipt1.style.display = "block ";
ipt2.style.display = "block ";
ipt3.style.display = "block ";
}
</script>