<html>
<head>
<title>
ssssssssssss
</title>
<style?type="text/css">
#con{color:red;
?????width:300px;height:200px;
?????border:1px?solid?pink;
}
</style>
</head>
<body>
<div?id="con">堅實的快速健康的驕傲是肯定江蘇曠達看藍精靈</div>
<script?type="text/javascript">
function?qqq()
{
var?k=document.getElementById("con");
k.style.color="green";
}
function?www()
{
var?k=document.getElementById("con");
k.style.height="500px";
?k.style.width="400px";
}
function?eee()
{
var?k=document.getElementById("con");
k.style.display="none";
}
function?rrr()
{
var?k=document.getElementById("con");
k.style.display="block";
}
function?ttt()
{
var?k=document.getElementById("con");
var?this=confirm("重置內容?");
if(this==true)
{
k.removeAttribute("style");
}
}
</script>
<input?type="button"?onclick="qqq()"?value="改變顏色"?/>
<input?type="button"?onclick="www()"?value="改變長寬"?/>
<input?type="button"?onclick="eee()"?value="隱藏文本"?/>
<input?type="button"?onclick="rrr()"?value="顯示文本"?/>
<input?type="button"?onclick="ttt()"?value="重置文本"?/>
</body>
</html>
我用記事本寫得,檢查好幾遍查不出錯誤啊,哎,用360瀏覽器打開,按鈕一個都不好使,顯示不出效果。謝謝啦
2017-05-05
找到問題關鍵了,重置那里var 不能取this,得換一個;不過改完后其他按鈕好使了,但是重置按鈕就是不好使啊,還得求幫忙啊
2017-05-05
var?this=confirm("重置內容?");
if(this==true)
this關鍵字啊親,不要亂用,換個對象名,隨便aaa也行
var aaa=confirm("重置內容?");
if(aaa==true)