有没有人有正确的代码,我不会写,谢谢
<script type="text/javascript">
//定义"改变颜色"的函数
var txt = document.getElementById("txt");
function changeColor(){
txt.style.color = "red";
}
//定义"改变宽高"的函数
function changeWH(){
txt.style.width = "300px";
txt.style.height = "300px";
}
//定义"隐藏内容"的函数
function hide(){
txt.style.display = "none";
}
//定义"显示内容"的函数
function show(){
txt.style.display = "block";
}
//定义"取消设置"的函数
function resetChange(){
var a = confirm("是否还原?");
if ( a==true ){
txt.style.color = "#000";
txt.style.width = "600px";
txt.style.height = "400px";
}
}
</script>
function color(){
var h2 = document.getElementById("con");
h2.style.color="red";
h2.style.backgruondcolor = "#ccc";
}