编辑:由于问题已经变得相当流行,我将解决这个问题,所以它将工作的代码示例。原来的问题仍然列出,但代码工程。用JavaScript改变DIV的可见性
我想按下按钮后显示一个div,但这不会工作,任何想法为什么是这样的?
<form action="insert.php" method="POST" align="right" id="post_form">
<input type="button" value="click me" onClick="show()">
<div id="show_button"> fdsfds </div><br>
</form>
#show_button{
visibility:hidden;
}
function show(){
// alert("cheked the button - worked");
document.getElementById("show_button").style.visibility= 'visible' ;
}
你应该换行ID引号:'的document.getElementById( “show_button”)' – Antony 2013-04-21 14:51:07
@Antony你是如此的权利我的朋友,要多浪费时间。 ..非常感谢上帝保佑你。 – 2013-04-21 14:53:20