--------------------------------------------------------------------------------------------------------
HTML處的寫法:
<a href = "javascript:showPasswordInput()">重置密碼</a> <tr id = "passwordRow" style = "display:none"> <input type = "text" name = "password" id = "passwordID" value = ""> </tr>--------------------------------------------------------------------------------------------------------
JavaScript處的寫法:
<script type="text/javascript"> function showPasswordInput() { var passwordRow = document.getElementById( 'passwordRow' ); passwordRow.style.display = ""; } </script>--------------------------------------------------------------------------------------------------------
一開始<tr>那行內的密碼輸入框是隱藏的,接著點擊按鈕後在Function內重新設定style.display成顯示狀態。
style.display有很多屬性,比較常用的有:
style.display = "none"
style.display = "block"
style.display = "inline"......等
這邊是很無厘頭的寫style.display = ""。
沒有留言:
張貼留言