<body>
<input type="textbox" id="fname"></input>
<button type="button" onclick="javascript:show('select'); return false;">Click</button></br>
<input type="radio" id="select" style="display:none;"></input>
</body>
我寫的代碼似乎是合乎邏輯的,但在這種情況下,當我點擊按鈕,它似乎沒有奏效。任何任何一個可以告訴我在哪裏可以我已經錯了顯示使用JavaScript隱藏
在此先感謝。
<head>
<title>show and hide javascript</title>
<script type="text/javascript">
function show(id) {
//alert("Its working");
var myId = document.getElementById.id;
if (myId.style.display = 'none') {
myId.style.display = 'block';
} else {
myId.style.display = 'none';
}
}
</script>
</head>
你'如果(myId.style.display = 'none''應該是'==' none'' – bokonic 2012-07-16 19:25:13
我第一次見過'' – Musa 2012-07-16 19:27:37
我做了='沒有'爲=='沒有',但仍然不工作 – 2012-07-16 19:27:52