編輯:由於問題已經變得相當流行,我將解決這個問題,所以它將工作的代碼示例。原來的問題仍然列出,但代碼工程。用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