为什么我输入的代码运行不了
<input type="button" value="改变颜色" onClick="changeColor()">
<input type="button" value="改变宽高" onClick="changeSize()">
<input type="button" value="隐藏内容" onClick="hidetext()">
<input type="button" value="显示内容" onClick="showtext()">
<input type="button" value="取消设置" onClick="offset()" >
</form>
<script type="text/javascript">
var txt=document.getElementById("txt");
{
function changeColor(){
txt.style.color="red";
txt.style.backgroundColor="#ccc";
}
function changeSize(){
txt.style.width="500px";
txt.style.height="700px";
}
function hidetext(){
txt.style.display="none";
}
function showtext(){
txt.style.display="block";
}
function offset(){
var mychar=confirm("确定要重置所有设置吗?");
if(mychar==true){
txt.removeAttribute('style');
}
}
}