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

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

用button隱藏和顯示 怎么實現(xiàn)不了 請指教

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>style樣式</title>

</head>

<body>

? <h2 id="con">I love JavaScript</H2>

? <p> JavaScript使網(wǎng)頁顯示動態(tài)效果并實現(xiàn)與用戶交互功能。</p>

? <script type="text/javascript">

? var mychar=document.getElementById("con");

? mychar.style.color="red";

? mychar.style.backgroundColor="#CCC";

??

? function yin(){

? ? ? mychar.style.display="none";

? }

??

? ? ? function xianshi(){

? ? ? ? ??

? ? ? ?mychar.style.display="block";

? ?}

? ?


? </script>

? <form>

? <input type="button" name="xianshi" value="xianshi" onclick="xianshi()"/>

? <input type="button" name="yin" value="yin" onclick="yin()"/>

?</form>

?


</body>

</html>


正在回答

3 回答

問題出在form表單,把form去掉就行

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

慕婉清917633 提問者

非常感謝!
2018-08-18 回復(fù) 有任何疑惑可以回復(fù)我~
#2

doits

具體點(diǎn),不是form的事,是兩個input里面的name的事,把兩個name去掉就行了,在form里,添加了name屬性就意味著表單數(shù)據(jù)進(jìn)行標(biāo)識。
2018-12-10 回復(fù) 有任何疑惑可以回復(fù)我~

看我代碼哈:


<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>style樣式</title>

</head>

<body>

? <h2 id="con">I love JavaScript</h2>

? <p> JavaScript使網(wǎng)頁顯示動態(tài)效果并實現(xiàn)與用戶交互功能。</p>

? <script type="text/javascript">

? ?

? ?var conValue = document.getElementById("con");

? ?

? ?function setColor() {

? ? ? ?conValue.style.color = "red";

? ? ? ?conValue.style.backgroundColor.color = "#CCC";

? ?}

? ?

? ?function styleHide() {

? ? ? ?conValue.style.display = "none";

? ?}

? ?

? ?function showValue() {

? ? ? ?conValue.style.display = "block";

? ?}

?

? </script>

??

? <form>?

? ? <input type="button" value="改變顏色" onclick="setColor()" />

? ? <input type="button" value="點(diǎn)擊隱藏" onclick="styleHide()" />

? ? <input type="button" value="點(diǎn)擊顯示" onclick="showValue()">

? </form>

??

</body>

</html>


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

慕尼黑2187906

改變顏色那塊背景顏色多打了一個color吧
2019-10-08 回復(fù) 有任何疑惑可以回復(fù)我~

你這個Id"con"沒有寫在input 里面啊

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

舉報

0/150
提交
取消

用button隱藏和顯示 怎么實現(xiàn)不了 請指教

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

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

幫助反饋 APP下載

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

公眾號

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