hello,各位親,為什么我的在這邊鞥運行,但在subline上運行不了呢?
?function Color()
? {
??? var con=document.getElementById("con");
??? con.style.color="red";
? }
? function Width()
? {
??? var con=document.getElementById("con");
??? con.style.width="400px";
??? con.style.height="250px";
? }
? function hidetext()
? {
??? var con=document.getElementById("con");
??? con.style.display="none";
? }
? function showtext()
?{
??? var con=document.getElementById("con");
??? con.style.display="block";
? }
? function Cancel()
? {
??? var con=document.getElementById("con");
??? var ifcancel=confirm("do you really want to cancel?")
??? if (ifcancel==true)
????? {
??????? var con=document.getElementById("con");
??????? con.removeAttribute("style");
????? }
?
? } ?
?html中是這樣寫的,一直提示color沒定義
<h2>javascript 改變顏色等</h2>
<div id="con">
? <h2>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。 </h2>
? <p id="p">1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
? <p id="p">2. JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>
? <p id="p">3.學(xué)完以上兩門基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對象、運動、cookie、正則表達(dá)式、ajax等課程。</p>
</div>
<form>
? <input type="button" value="改變顏色" onclick="Color()"/>
? <input type="button" value="改變尺寸" onclick="Width()"/>
? <input type="button" value="設(shè)置隱藏" onclick="hidetext()"/>
? <input type="button" value="設(shè)置顯示" onclick="showtext()"/>
? <input type="button" value="取消設(shè)置" onclick="Cancel()"/>
</form>
2015-11-15
怎么都沒看到j(luò)s的外部引用之類的東西
2015-11-15
你的格式不對把
2015-11-15
你的 script 標(biāo)簽在哪?