一個(gè)都是實(shí)現(xiàn)不了
<form>
? <!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
? ? <input type="button" value="改變顏色" onClick="col()" >??
? ? <input type="button" value="改變寬高" onClick="cof()">
? ? <input type="button" value="隱藏內(nèi)容" onClick="hid()">
? ? <input type="button" value="顯示內(nèi)容" onClick="dis()">
? ? <input type="button" value="取消設(shè)置" onClick="cel()">
? </form>
? <script type="text/javascript">
? ??
//定義"改變顏色"的函數(shù)
function col(){
? ? var identity=confirm("確認(rèn)修改");
? ? if(identity==ture){
? ? ? ? var pp = document.getElementById("txt");
? ? ? ? pp.style.color="blue";
? ? }
? ? eles{
? ? ? ? cel();
? ? }
? ??
}
//定義"改變寬高"的函數(shù)
function wid(){
? ? var identity=confirm("確認(rèn)修改?");
? ? if(identity==ture){
? ? ? ?var pp = document.getElementById("txt");
? ? pp.style.width="200";
? ? }
? ? eles{
? ? ? ? cel();
? ? }
? ??
}
//定義"隱藏內(nèi)容"的函數(shù)
function hid(){
? ? ?var identity=confirm("確認(rèn)修改?");
? ? if(identity==ture){
? ? ? ? var pp = document.getElementById("txt");
? ? pp.style.display="none";
? ? }
? ? eles{
? ? ? ? cel();
? ? }
? ?
}
//定義"顯示內(nèi)容"的函數(shù)
function dis(){
? ? ?var identity=confirm("確認(rèn)修改?");
? ? ?if(identity==ture){
? ? ? ? var pp = document.getElementById("txt");
? ? ? ? pp.style.display="block";
? ? }
? ? eles{
? ? ? ? cel();
? ? }
?
}
//定義"取消設(shè)置"的函數(shù)
function cel(){
? ? var pp = document.getElementById("txt");
? ? pp.className="txt";
}
2018-11-05
?pp.className="txt";
txt是id,不是className
2018-11-05
每個(gè)方法之間要都好隔開? 感覺你這樣寫好麻煩
2018-11-05
true
2018-11-05
else