<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><style>body{ text-align:center; font:12px Normal,"Microsoft Yahei"; text-indent;2em; background:#ccc;}#container { width:900px; min-height:500px; height:auto; margin:0 auto; padding:10px 20px; text-align:left; background-color:#fff; border:1px solid #b1b1b1; display:block}#txt { width:500px; border:1px solid #ccc; padding:15px; margin:10px 0 10px;}.show { display:block;}.hide { display:none;}.btn { width:50px; height:30px; border:1px dotted #b1b1b1; display:block;}.default {font-size:10px; color:black;}.one {font-size:14px; color:green;}.two {font-size:20px; color:red;}</style></head><body><div id="container"><h2>綜合使用各類(lèi)Javascript命令</h2><script type="text/javascript"> var txt = document.getElementById("txt"); function show() { ?//定義顯示內(nèi)容 txt.style.display="block"; } function hide() { ?//定義隱藏內(nèi)容 txt.style.display="none"; }? function reset() { ?//恢復(fù)默認(rèn)? if(confirm("確定取消設(shè)置?")){ txt.removeAttribute("style");? } } function changeColor() { //改變顏色 txt.style.color="red"; } function changeWidth() { ?//改變寬度 txt.style.width="500px"; } function changeHeight() { ?//改變高度 txt.style.height="500px"; } function changeBgcolor() { ?//改變背景顏色 txt.style.background-color="red"; }</script> <input type="reset" value="reset" onclick="Reset()"/> <input type="button" value="change color" onclick="changeColor()"/> <input type="button" value="change width" onclick="changeWidth()"/> <input type="button" value="change height" onclick="changeHeight()"/> <input type="button" value="change background color" onclick="changeBgcolor()" /> <input type="button" value="click to show" onclick="show()" /> <input type="button" value="click to hide" onclick="hide()" /> <p>點(diǎn)擊按鈕改變顏色,寬、高,背景顏色,并提供選項(xiàng)恢復(fù)默認(rèn)顏色。</p> <div id="txt"> <h5>JavaScript為網(wǎng)頁(yè)添加動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶交互的功能。</h5>? ? ? ? <p>1. JavaScript入門(mén)篇,讓不懂JS的你,快速了解JS。</p>? ? ? ? <p>2. JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語(yǔ)法、函數(shù)、數(shù)組、事件、內(nèi)置對(duì)象、BOM瀏覽器、DOM操作。</p>? ? ? ? <p>3. 學(xué)完以上兩門(mén)基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對(duì)象、運(yùn)動(dòng)、cookie、正則表達(dá)式、ajax等課程。</p> </div></div></body></html>
求助: 代碼中的到底錯(cuò)誤在哪兒?
慕碼人3596952
2015-12-24 15:46:55