按鈕沒反應,代碼在下面,前面沒動!
?<form>
? <!--當點擊相應按鈕,執行相應操作,為按鈕添加相應事件-->
? ?<input type="button" value="改變顏色" onclick="turn_color()"> ?
? ? <input type="button" value="改變寬高" ?onclick="turn_wh()">
? ? <input type="button" value="隱藏內容" ?onclick="hidden()">
? ? <input type="button" value="顯示內容" ?onclick="appear()">
? ? <input type="button" value="取消設置" ?onclick="cancel()">
? </form>
? <script type="text/javascript">
? var char=document.getElementById("txt");
function turn_color(){
? ??
? ? char.style.color="red";
? ? }
function turn_wh(){
? ?
? ? char.style.width="900px";
? ? char.style.heigth="600px";
? ? }//定義"改變顏色"的函數
function hidden(){
? ?
? ? char.style.display="none";
? ??
}
function appear(){
? ??
? ? char.style.display="block";
? ??
}
function cancel(){
??
? ? var choose=confirm("確認取消?");
? ? if(choose==true){char.style.color="#000";
? ? char.style.width="600px";
? ? char.style.heigth="400px";
? ? char.style.display="block";
? ? }
? ? else{}
? </script>
</body>
</html>
2016-09-03
是onClick,這里不對
2016-09-03
最后少打了一個括號。不好意思了。。。