<input type="button" value="改变颜色" onclick="setcolor()"> <input type="button" value="改变宽高" onclick=setWH()> <input type="button" value="隐藏内容" onclick=hidetext()> <input type="button" value="显示内容" onclick=showtext()> <input type="button" value="取消设置" onclick=offset()> </form> <script type="text/javascript"> function setcolor() {var mychar=document.getElementById("txt"); mychar.style.color="red"; mychar.style.backgroundColor="#369";} function setWH() {var mychar=document.getElementById("txt"); mychar.style.width="500px"; mychar.style.height="500px";} function hidetext() {var mychar=document.getElementById("txt"); mychar.style.display="none";} function showtext() {var mychar=document.getElementById("txt"); mychar.style.display="block";} function offset() {var mychar=confirm("你要取消设置吗?"); if(mychar==true) txt.removeAttribute("style"); } 其他都可以,就是取消设置不行,为什么呢?
添加回答
举报
0/150
提交
取消