代碼對(duì)嗎?
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
var myob=document.getElementById("con");
var mytxt=document.getElementById("txt");
function color(){
?myob.style.color="red";
?myob.style.backgroundColor="grey";
}
//定義"改變寬高"的函數(shù)
function cheight(){
?mytxt.style.width="300px";
?mytxt.style.height="200px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function hide(){
?myob.style.display="none"; ?
}
//定義"顯示內(nèi)容"的函數(shù)
function show(){
?myob.style.display="block"; ?
}
//定義"取消設(shè)置"的函數(shù)
function cancel(){
??? var message = confirm("是否取消設(shè)置?");
??? if(message == true){ location.reload() ; } }
? </script>
2015-02-11
不對(duì),在JS中hide和show是JS中的關(guān)鍵字,把函數(shù)名換個(gè)名稱