第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

這樣是否符合要求

<!DOCTYPE html>
<html>
<head>
?<meta charset="utf-8">
?<title></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課程</h2>
<div id="txt">
?<h5 >JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互功能。</h5>
?<p>1.JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
?<p>2.JavaScript進階篇,讓你掌握J(rèn)S的基本語法,函數(shù),數(shù)組,事件,內(nèi)置對象,BOM瀏覽器,DOM操作。</p>
</div>
<form>
?<input type="button"? value="改變顏色" onclick="ys()"/>
?<input type="button"? value="改變寬高" onclick="kg()"/>
?<input type="button"? value="隱藏內(nèi)容" onclick="yc()"/>
?<input type="button"? value="顯示內(nèi)容" onclick="xs()"/>
?<input type="button"? value="取消設(shè)置" onclick="qxsz()"/>
</form>
<script type="text/javascript">
?function ys(){
??var p=document.getElementById("txt");
??p.style.color="red";??
?}
?function kg(){
??var mykg=document.getElementById("txt");
??mykg.style.width="350px";
??mykg.style.height="200px";
?}
?function yc(){
??var myyc=document.getElementById("txt");
??myyc.style.display="none";
?}
?function xs(){
??var myxs=document.getElementById("txt");
??myxs.style.display="block";
?}
?function qxsz(){
??var title=confirm("是否取消設(shè)置?");
??if(title==true){
??????? txt.removeAttribute("style");
??}
??else{

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


正在回答

3 回答

就是比如你的css樣式不都是寫在<style></style>標(biāo)簽里面嗎?如果你在里面比如這樣寫了

<body>

<h1 style="color:red; font-size:12px;">樣式</h1>//這樣子的樣式

<input type="button value="清除樣式" onclick="xiaochu()"/>

function xiaochu(){

????? document.getElementByTagName("h1").removeAttibute("style");

}意思就是清除你之前在<style>標(biāo)簽里面所定義的字號以及顏色!還原成初始值

0 回復(fù) 有任何疑惑可以回復(fù)我~

style的意思就是讓div的樣式回到初始

0 回復(fù) 有任何疑惑可以回復(fù)我~

我覺得你寫的是對的,功能都可以實現(xiàn),我有一個不明白的,就是那個取消設(shè)置里面的,removeAttribute("style"),style是什么意思。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

這樣是否符合要求

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號