亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么點完remove的按鈕之后這個按鈕就消失了?

<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?Content="text/html;?charset=utf-8"?/>
<title>javascript</title>
<style?type="text/css">
body{font-size:12px;}
#txt{
????height:400px;
????width:600px;
	border:#333?solid?1px;
	padding:5px;}
p{
	line-height:18px;
	text-indent:2em;}

</style>

</head>
<body>
??<h2?id="con">JavaScript?course</H2>
??<div?id="txt">?
?????<h5>JavaScript?index</h5>
????????<p>1.?JavaScript?elementary</p>
????????<p>2.?JavaScript?advanced</p>
????????<p>3.?more?functions</p>
??</div>
??<form>
??<!--當點擊相應按鈕,執行相應操作,為按鈕添加相應事件-->
????<input?type="button"?value="change?color"?onclick="changecolor()">??
????<input?type="button"?value="change?size"?onclick="changesize()">
????<input?type="button"?value="hide?content"?onclick="hidecontent()">
????<input?type="button"?value="show?content"?onclick="showcontent()">
????<input?type="button"?value="remove?all?style"?onclick="remove()">
??</form>
??<script?type="text/javascript">
??	var?text=document.getElementById("txt");
//定義"改變顏色"的函數
function?changecolor(){
			text.style.color="red";
			text.style.backgroundColor="gray";
		};

//定義"改變寬高"的函數
function?changesize?()?{
	txt.style.width="200px";
	txt.style.height="200px";
}

//定義"隱藏內容"的函數
function?hidecontent?()?{
	txt.style.display="none";
}

//定義"顯示內容"的函數
function?showcontent?()?{
	txt.style.display="block";
}

//定義"取消設置"的函數
function?remove?()?{
	text.removeAttribute("style");
}




??</script>
</body>
</html>


正在回答

5 回答

函數名remove換成其他的,我也是這個問題,換掉就可以了

0 回復 有任何疑惑可以回復我~
#1

瀅芷 提問者

非常感謝!
2016-11-18 回復 有任何疑惑可以回復我~

代碼輸錯了兄弟,??txt.style.width="200px";請問這句是什么意思,是text吧

0 回復 有任何疑惑可以回復我~

IE8-11,edge成功運行,沒問題

0 回復 有任何疑惑可以回復我~

http://img1.sycdn.imooc.com//58205d790001c0f507350568.jpg確實沒有啊,我用的搜狗,ie和edge都不行

0 回復 有任何疑惑可以回復我~

沒有吧 你重新打開試試 ?或者換個瀏覽器 ,我運行了一下,沒有問題的啊。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么點完remove的按鈕之后這個按鈕就消失了?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號