最后那個取消設置怎么改都不對?大家?guī)臀铱纯茨?/h1>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onclick="yanse()">??
? ? <input type="button" value="改變寬高" onclick="gao()">
? ? <input type="button" value="隱藏內(nèi)容" onclick="hide()">
? ? <input type="button" value="顯示內(nèi)容" onclick="nohide()">
? ? <input type="button" value="取消設置" onclick="quxiao()">
? </form>
? <script type="text/javascript">
var mychar=document.getElementById("txt");
//定義"改變寬高"的函數(shù)
function yanse(){
mychar.style.color="blue";
mychar.style.backgroundColor="yellow";
}
//定義"改變寬高"的函數(shù)
function gao(){
mychar.style.width="400px";
mychar.style.height="200px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
mychar.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function nohide(){
mychar.style.display="block";
}
//定義"取消設置"的函數(shù)
function quxiao(){
var wenti=confirm("是否取消設置?");
if(wenti==ture){
mychar.removeAttribute('style');
}
}
? </script>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onclick="yanse()">??
? ? <input type="button" value="改變寬高" onclick="gao()">
? ? <input type="button" value="隱藏內(nèi)容" onclick="hide()">
? ? <input type="button" value="顯示內(nèi)容" onclick="nohide()">
? ? <input type="button" value="取消設置" onclick="quxiao()">
? </form>
? <script type="text/javascript">
var mychar=document.getElementById("txt");
//定義"改變寬高"的函數(shù)
function yanse(){
mychar.style.color="blue";
mychar.style.backgroundColor="yellow";
}
//定義"改變寬高"的函數(shù)
function gao(){
mychar.style.width="400px";
mychar.style.height="200px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
mychar.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function nohide(){
mychar.style.display="block";
}
//定義"取消設置"的函數(shù)
function quxiao(){
var wenti=confirm("是否取消設置?");
if(wenti==ture){
mychar.removeAttribute('style');
}
}
? </script>
2019-08-02
true寫成了ture