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