沒反應啊,咋回事
?<form>
? <!--當點擊相應按鈕,執行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onclick="color()">??
? ? <input type="button" value="改變寬高" onclick="hw()">
? ? <input type="button" value="隱藏內容" onclick="none()">
? ? <input type="button" value="顯示內容" onclick="block()">
? ? <input type="button" value="取消設置" onclion="off()">
? </form>
? <script type="text/javascript">
? var css=document.getElementById("txt");
//定義"改變顏色"的函數
function color(){
? ? css.style.color='#000';
? ? css.style.backgroundColor='#02194';
}
//定義"改變寬高"的函數
function wh(){
? ? css.style.width='400px';
? ? css.style.height='500px';
}
//定義"隱藏內容"的函數
? ? function none(){
? ? ? ? css.style.display='none';
? ? }
//定義"顯示內容"的函數
? ? function block(){
? ? ? ? css..style.display='block';
? ? }
//定義"取消設置"的函數
? ? function? off(){
? ? ? ? var or=confirm('確認是否重置?');
? ? ? ? if(or==true){
? ? ? ? ? ? css.removeAttribute('style');
? ? ? ? }
? ? ? ? else(set){}
? ? }
? </script>
2021-05-26
改變顏色的函數改后的顏色跟原來的一樣,所以沒變化。
改變寬高的函數名稱與調用的函數名稱不一致。
顯示內容的函數css.style之間多了個點css..style