其他都好好的,最后兩個是不行的為什么?
? <input type="button" value="改變顏色" OnClick="color()">??
? ? <input type="button" value="改變寬高" OnClick="WH()">
? ? <input type="button" value="隱藏內(nèi)容" OnClick="disshow()">
? ? <input type="button" value="顯示內(nèi)容" OnClick="show()">
? ? <input type="button" value="取消設(shè)置" OnClick="NO()">
? </form>
? <script type="text/javascript">
? function color(){
? ? ? ?var mychar = document.getElementById("txt");??
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
? }
? function WH(){
? ? ? var mychar=document.getElementById("txt");
? ? ? mychar.style.width="250px";
? ? ? mychar.style.height="250px";
? }
? function disshow(){
? ? ? var mychar=document.getElementById("txt");
? ? ? mychar.style.display="none";
? ? ??
? }
? function show(){
? ? ? var mychar=document.getElementById("txt");
? ? ? mychar.style.daiplay="block";
? }
function NO(){
? ? var mychar=document.getElementById("txt");
? ? mychar.style.color="black";
? ? mychar.style.bakcgroundColor="white";
? ? mychar.style.width="600px";
? ? mychar.style.height="400px";
}
2018-02-07
倒數(shù)第二個函數(shù)最后一行的display拼錯,最后一個函數(shù)不可以這樣寫,代碼累贅,可以這樣
? ? var p1=document.getElementById("txt");
function CC(){
? ? p1.style.color="red";
? ?p1.style.backgroudColor="#CCC";
}
function CS(){
? ? p1.style.width="400px";
? ? p1.style.height="400px";
}
function hide(){
? ? p1.style.display="none";
}
function show(){
? ? p1.style.display="block";
}
2018-01-27
已發(fā)現(xiàn)錯誤,是簡單拼寫錯誤