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