這樣編寫 對嗎??
var txt=document.getElementById("txt");
//定義"改變顏色"的函數(shù)
function changeColor(){
? ? txt.style.color="red";
? ? txt.style.backgroundColor="#ccc";
}
//定義"改變寬高"的函數(shù)
function changeSize(){
? ? txt.style.width="700px";
? ? txt.style.height="200px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function hidetext(){
? ? txt.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function showtext(){
? ? txt.style.display="block";
}
//定義"取消設置"的函數(shù)
function offSet(){
? ? var mymessage=confirm("你確定要重置所有設置嗎?");
? ? if(mymessage==true){
? ? txt.removeAttribute("style");?
? ?}
}
2016-03-22
不是很好