为啥没效果呀
为什么没效果呀?
<input type="button" value="改变颜色" onclick="changeColor()">
<input type="button" value="改变宽高" onclick="changeSize()">
<input type="button" value="隐藏内容" onclick="objHide()">
<input type="button" value="显示内容" onclick="objShow()">
<input type="button" value="取消设置" onclick="offSet()">
</form>
<script type="text/javascript">
var obj=document.getElementById("txt");
function changeColor()
{
obj.style.color="blue";
obj.style.backgroundColor="red";
}
function changeSize()
{
obj.style.width="300px";
obj.style.height="500px";
}
function objHide()
{
obj.style.display="none";
}
function objShow()
{
obj.style.display="block";
}
function offSet()
{
var mymessage=confirm("确定取消设置?");
if(mymessage)
{
obj.removeAttribute('style');
}
}