最后一個按鈕一直沒反應不知道怎么做
?<!--當點擊相應按鈕,執行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onClick="colorchange()">??
? ? <input type="button" value="改變寬高" onClick="wh()" >
? ? <input type="button" value="隱藏內容" onClick="yc()">
? ? <input type="button" value="顯示內容" onClick="xs()">
? ? <input type="button" value="取消設置" onClick="qx()">
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數
var c=document.getElementById("txt");
function colorchange(){
? ? c.style.color="red";
}
//定義"改變寬高"的函數
function wh(){
? ? document.getElementById("txt").style.width="300px";
document.getElementById("txt").style.height="300px";
}
//定義"隱藏內容"的函數
function yc(){
? ? c.style.display="none";
}
//定義"顯示內容"的函數
function xs(){
? ? c.style.display="block";
}
//定義"取消設置"的函數
function qx(){
? ?var set=comfirm("是否取消設置");
? ? if(set==true){
? ? ? ? txt.removeAttribute('style');
? ? }
}
2019-10-25
? ? ? ? txt.removeAttribute('style');改為c.removeAttribute('style');