課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
正確的應該怎么寫哦,誰能教我一下,還有就是,這個提交能不能修好了可以測試啊,怎么寫提交都是對的。
2016-06-05
源自:JavaScript入門篇 4-1
正在回答
一般情況下是這樣的?,F(xiàn)在網(wǎng)上的系統(tǒng)盤很方便,你可以極其輕松地安裝系統(tǒng),不過,對一些非常重要的資料,還是事前用U盤拷一份穩(wěn)當一些。畢竟,意外隨時可能發(fā)生。
兄弟,先將資料轉(zhuǎn)移出來啊
dxyz 提問者
重裝系統(tǒng)啊。
當然可以測試了
編寫代碼過程中出現(xiàn)失誤在所難免,
那,有沒有方法避免這個問題呢?
答案是:有的
用編輯器吧,有什么錯誤,它都會告訴你。
EditPlus 4 ? ? 特好用,自己百度下載。
<!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課程</H2>
? <div id="txt">?
? ? ?<h5>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。</h5>
? ? ? ? <p>1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
? ? ? ? <p>2. JavaScript進階篇,讓你掌握JS的基礎語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>
? ? ? ? <p>3. 學完以上兩門基礎課后,在深入學習JavaScript的變量作用域、事件、對象、運動、cookie、正則表達式、ajax等課程。</p>
? </div>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onclick="color()"> ?
? ? <input type="button" value="改變寬高" onclick="change_height()">
? ? <input type="button" value="隱藏內(nèi)容" onclick="change_content1()">
? ? <input type="button" value="顯示內(nèi)容" onclick="change_content2()">
? ? <input type="button" value="取消設置" onclick="cancel()">
? </form>
? <script type="text/javascript">
? var mychar1 = document.getElementById('con');
? var mychar2 = document.getElementById('txt');
? ? function color(){
? ? ? ??
? ? ? ? mychar1.style.color = "red";
? ??
? ? function change_height(){
? ? ? ? mychar2.style.height = "150px";
? ? }
? ? function change_content1(){
? ? ? ? mychar2.style.display = "none";
? ? function change_content2(){
? ? ? ? mychar2.style.display = "block";
? ? function cancel(){
? ? ? ? if(confirem="恢復原始值?"){
? ? ? ? ? ? mychar1.style.color = "black";
? ? ? ? ? ? mychar2.style.height = "200px";
? ? ? ? ? ? mychar2.style.display = "block";
? ? ? ? }
? </script>
</body>
</html>
text-indent:2em;
? <form id="myform">
? ? <input type="button" value="改變顏色" > ?
? ? <input type="button" value="改變寬高" >
? ? <input type="button" value="隱藏內(nèi)容" >
? ? <input type="button" value="顯示內(nèi)容" >
? ? <input type="button" value="取消設置" >
//定義"改變顏色"的函數(shù)
//定義"改變寬高"的函數(shù)
var a=document.getElementById("myform").getElementsByTagName("input");
var b=document.getElementById("txt");
a[0].onclick=function(){
b.style.color="red";
}
a[1].onclick=function(){ ? ?
? ? b.style.width="90%";
? ? ?b.style.width="110%"; ? ?
a[2].onclick=function(){ ? ?
? ? b.style.display="none";
a[3].onclick=function(){ ? ?
? ? b.style.display="block"; ? ?
a[4].onclick=function(){ ??
? ?var msg=confirm("是否取消設置?");
? ?if(msg==true) ?
? ? ? ? { ? ? ? ? ??
? ? ? ? ? ? b.removeAttribute("style"); ? ? ? ? ? ??
<!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課程</H2>? <div id="txt"> ???? <h5>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。</h5>??????? <p>1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>??????? <p>2. JavaScript進階篇,讓你掌握JS的基礎語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>??????? <p>3. 學完以上兩門基礎課后,在深入學習JavaScript的變量作用域、事件、對象、運動、cookie、正則表達式、ajax等課程。</p>? </div>? <form>? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->??? <input type="button" value="改變顏色" onClick="rColor()">? ??? <input type="button" value="改變寬高" onClick="rWH()">??? <input type="button" value="隱藏內(nèi)容" onClick="nDisplay()">??? <input type="button" value="顯示內(nèi)容" onClick="yDisplay()">??? <input type="button" value="取消設置" onClick="rReturn()">? </form>? <script type="text/javascript">//定義"改變顏色"的函數(shù)function rColor(){??? var mychar=document.getElementById("txt");??? mychar.style.color="red";??? mychar.style.background="blue";}//定義"改變寬高"的函數(shù)function rWH(){??? var mychar=document.getElementById("txt");??? mychar.style.width="300px";??? mychar.style.height="500px";}
//定義"隱藏內(nèi)容"的函數(shù)function nDisplay(){??? var mychar=document.getElementById("txt");??? mychar.style.display="none";}
//定義"顯示內(nèi)容"的函數(shù)function yDisplay(){??? var mychar=document.getElementById("txt");??? mychar.style.display="block";}
//定義"取消設置"的函數(shù)function rReturn(){??? var queren=confirm("確認是否取消設置");??? if(queren==true)??? {??????? document.getElementById("txt").removeAttribute("style");??? }}
舉報
JavaScript做為一名Web工程師的必備技術,本教程讓您快速入門
2 回答js入門篇最后一個綜合練習,求大神指點我錯在那
2 回答求大神指導
1 回答求大神指導
1 回答js入門篇最后一個編程挑戰(zhàn)
2 回答打不開??!求大神指導
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2016-06-15
一般情況下是這樣的?,F(xiàn)在網(wǎng)上的系統(tǒng)盤很方便,你可以極其輕松地安裝系統(tǒng),不過,對一些非常重要的資料,還是事前用U盤拷一份穩(wěn)當一些。畢竟,意外隨時可能發(fā)生。
2016-06-13
兄弟,先將資料轉(zhuǎn)移出來啊
2016-06-11
重裝系統(tǒng)啊。
2016-06-11
當然可以測試了
編寫代碼過程中出現(xiàn)失誤在所難免,
那,有沒有方法避免這個問題呢?
答案是:有的
用編輯器吧,有什么錯誤,它都會告訴你。
EditPlus 4 ? ? 特好用,自己百度下載。
2016-06-09
<!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課程</H2>
? <div id="txt">?
? ? ?<h5>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。</h5>
? ? ? ? <p>1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
? ? ? ? <p>2. JavaScript進階篇,讓你掌握JS的基礎語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>
? ? ? ? <p>3. 學完以上兩門基礎課后,在深入學習JavaScript的變量作用域、事件、對象、運動、cookie、正則表達式、ajax等課程。</p>
? </div>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onclick="color()"> ?
? ? <input type="button" value="改變寬高" onclick="change_height()">
? ? <input type="button" value="隱藏內(nèi)容" onclick="change_content1()">
? ? <input type="button" value="顯示內(nèi)容" onclick="change_content2()">
? ? <input type="button" value="取消設置" onclick="cancel()">
? </form>
? <script type="text/javascript">
? var mychar1 = document.getElementById('con');
? var mychar2 = document.getElementById('txt');
? ? function color(){
? ? ? ??
? ? ? ? mychar1.style.color = "red";
? ??
? ? function change_height(){
? ? ? ??
? ? ? ? mychar2.style.height = "150px";
? ? }
? ? function change_content1(){
? ? ? ? mychar2.style.display = "none";
? ? }
? ? function change_content2(){
? ? ? ? mychar2.style.display = "block";
? ? }
? ? function cancel(){
? ? ? ? if(confirem="恢復原始值?"){
? ? ? ? ? ? mychar1.style.color = "black";
? ? ? ? ? ? mychar2.style.height = "200px";
? ? ? ? ? ? mychar2.style.display = "block";
? ? ? ? }
? ? }
? </script>
</body>
</html>
2016-06-05
<!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課程</H2>
? <div id="txt">?
? ? ?<h5>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。</h5>
? ? ? ? <p>1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
? ? ? ? <p>2. JavaScript進階篇,讓你掌握JS的基礎語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>
? ? ? ? <p>3. 學完以上兩門基礎課后,在深入學習JavaScript的變量作用域、事件、對象、運動、cookie、正則表達式、ajax等課程。</p>
? </div>
? <form id="myform">
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" > ?
? ? <input type="button" value="改變寬高" >
? ? <input type="button" value="隱藏內(nèi)容" >
? ? <input type="button" value="顯示內(nèi)容" >
? ? <input type="button" value="取消設置" >
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
//定義"改變寬高"的函數(shù)
var a=document.getElementById("myform").getElementsByTagName("input");
var b=document.getElementById("txt");
a[0].onclick=function(){
? ??
b.style.color="red";
}
? ??
a[1].onclick=function(){ ? ?
? ? b.style.width="90%";
? ? ?b.style.width="110%"; ? ?
}
a[2].onclick=function(){ ? ?
? ? b.style.display="none";
}
? ??
a[3].onclick=function(){ ? ?
? ? b.style.display="block"; ? ?
}
a[4].onclick=function(){ ??
? ?var msg=confirm("是否取消設置?");
? ?if(msg==true) ?
? ? ? ? { ? ? ? ? ??
? ? ? ? ? ? b.removeAttribute("style"); ? ? ? ? ? ??
? ? ? ? }
}
? </script>
</body>
</html>
2016-06-05
<!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課程</H2>
? <div id="txt">
???? <h5>JavaScript為網(wǎng)頁添加動態(tài)效果并實現(xiàn)與用戶交互的功能。</h5>
??????? <p>1. JavaScript入門篇,讓不懂JS的你,快速了解JS。</p>
??????? <p>2. JavaScript進階篇,讓你掌握JS的基礎語法、函數(shù)、數(shù)組、事件、內(nèi)置對象、BOM瀏覽器、DOM操作。</p>
??????? <p>3. 學完以上兩門基礎課后,在深入學習JavaScript的變量作用域、事件、對象、運動、cookie、正則表達式、ajax等課程。</p>
? </div>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
??? <input type="button" value="改變顏色" onClick="rColor()">?
??? <input type="button" value="改變寬高" onClick="rWH()">
??? <input type="button" value="隱藏內(nèi)容" onClick="nDisplay()">
??? <input type="button" value="顯示內(nèi)容" onClick="yDisplay()">
??? <input type="button" value="取消設置" onClick="rReturn()">
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
function rColor()
{
??? var mychar=document.getElementById("txt");
??? mychar.style.color="red";
??? mychar.style.background="blue";
}
//定義"改變寬高"的函數(shù)
function rWH()
{
??? var mychar=document.getElementById("txt");
??? mychar.style.width="300px";
??? mychar.style.height="500px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function nDisplay()
{
??? var mychar=document.getElementById("txt");
??? mychar.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function yDisplay()
{
??? var mychar=document.getElementById("txt");
??? mychar.style.display="block";
}
//定義"取消設置"的函數(shù)
function rReturn()
{
??? var queren=confirm("確認是否取消設置");
??? if(queren==true)
??? {
??????? document.getElementById("txt").removeAttribute("style");
??? }
}