課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
有沒有人有正確的代碼,我不會寫,謝謝
2016-05-05
源自:JavaScript入門篇 4-1
正在回答
<script type="text/javascript">
//定義"改變顏色"的函數(shù)
var txt = document.getElementById("txt");
? ? function changeColor(){
? ? ? ? txt.style.color = "red";
? ? }
//定義"改變寬高"的函數(shù)
? ? function changeWH(){
? ? ? ? txt.style.width = "300px";
? ? ? ? txt.style.height = "300px";
//定義"隱藏內(nèi)容"的函數(shù)
? ? function hide(){
? ? ? ? txt.style.display = "none";
//定義"顯示內(nèi)容"的函數(shù)
? ? function show(){
? ? ? ? txt.style.display = "block";
//定義"取消設(shè)置"的函數(shù)
? ? function resetChange(){
? ? ? ? var a = confirm("是否還原?");
? ? ? ? if ( a==true ){
? ? ? ? ? ? txt.style.color = "#000";
? ? ? ? ? ? txt.style.width = "600px";
? ? ? ? ? ? txt.style.height = "400px";
? ? ? ? }
</script>
function color(){
? ? ? ? var h2 = document.getElementById("con");
? ? ? ? h2.style.color="red";
? ? ? ? h2.style.backgruondcolor = "#ccc";
舉報
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答4-1編程挑戰(zhàn)
2 回答編程挑戰(zhàn)4-1
2 回答4-1編程挑戰(zhàn)
1 回答4-1編程挑戰(zhàn)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-05-05
<script type="text/javascript">
//定義"改變顏色"的函數(shù)
var txt = document.getElementById("txt");
? ? function changeColor(){
? ? ? ? txt.style.color = "red";
? ? }
//定義"改變寬高"的函數(shù)
? ? function changeWH(){
? ? ? ? txt.style.width = "300px";
? ? ? ? txt.style.height = "300px";
? ? }
//定義"隱藏內(nèi)容"的函數(shù)
? ? function hide(){
? ? ? ? txt.style.display = "none";
? ? }
//定義"顯示內(nèi)容"的函數(shù)
? ? function show(){
? ? ? ? txt.style.display = "block";
? ? }
//定義"取消設(shè)置"的函數(shù)
? ? function resetChange(){
? ? ? ? var a = confirm("是否還原?");
? ? ? ? if ( a==true ){
? ? ? ? ? ? txt.style.color = "#000";
? ? ? ? ? ? txt.style.width = "600px";
? ? ? ? ? ? txt.style.height = "400px";
? ? ? ? }
? ? }
</script>
2016-05-05
function color(){
? ? ? ? var h2 = document.getElementById("con");
? ? ? ? h2.style.color="red";
? ? ? ? h2.style.backgruondcolor = "#ccc";
? ? }