取消設(shè)置沒反應(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="Size()">
? ? <input type="button" value="隱藏內(nèi)容" onClick="hide()">
? ? <input type="button" value="顯示內(nèi)容" onClick="show()">
? ? <input type="button" value="取消設(shè)置" onClick="Reset()">
? </form>
? <script type="text/javascript">
? ? var div = document.getElementById("txt");
//定義"改變顏色"的函數(shù)
function Color(){
? ? div.style.color="red";
? ? div.style.backgroundColor="#ccc";
}
//定義"改變寬高"的函數(shù)
function Size(){
? ? div.style.width="200px";
? ? div.style.height="300px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
? ? div.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function show(){
? ? div.style.display="block";
}
//定義"取消設(shè)置"
function Reset(){
? ? ?choose = confirm("確定要重置嗎");
? ? if(choose==true){
? ? ? ?div.removeAttribute("style");
? ? }
}
? </script>
2016-06-18
2016-06-18
function Reset(){
? ? var choose = confirm("確定要重置嗎");
? ? if(choose==true){
? ? ? ?div.removeAttribute("style");
? ? }
2016-06-18
看樣子沒錯(cuò)啊