//定义"取消设置"的函数 function changeConfirm(){ styles = document.getElementById("txt"); var changes = confirm("确定取消设置吗?"); if(changes==true){ styles.removeAttribute("style"); }else{ document.write("取消操作"); } }
var text=document.getElementById("txt");
var defaultSettings=text.style;
//定义"取消设置"的函数
function restoreSetting(){
var ret=confirm("取消设置,恢复默认值?");
if(ret){
text.style=defaultSettings;
}
}
var txt=document.getElementById("txt");
var set={
changeColor:function(){
txt.style.color="red";
txt.style.backgroundColor="#ccc";
},
changeSize:function(){
txt.style.width="300px";
txt.style.height="300px";
},
objHide:function(){
txt.style.display="none";
},
objShow:function(){
txt.style.display="block";
},
offSet:function(){
var message=confirm("你确定要重置所有设置么?");
if(message==true){
txt.removeAttribute('style');
}
}
}