課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
使用confirm()確定框,來確認(rèn)是否取消設(shè)置。如是將以上所有的設(shè)置恢復(fù)原始值,否則不做操作。
恢復(fù)初始值怎么做呢
2015-05-10
源自:JavaScript入門篇 4-1
正在回答
用removeAttribute()這個(gè)方法也可以,用源碼中的那種方法也可以
明燭天南 提問者
function?sz(){ ????????var?sz=confirm("是否取消設(shè)置?"); ????????if(sz==true){ ????????var?sz=document.getElementById("txt").removeAttribute("style"); ????????} ????}
調(diào)用函數(shù)
function add5(){
? ? ? ? var mar=confirm("取消設(shè)置?");
? ? ? ? if(mar==true){
? ? ? ? ? ? var mar=document.getElementById("txt").removeAttribute("style");
? ? ? ? ? ? // var mar=document.getElementById("txt").style.width="600px";
? ? ? ? ? ? // var mar=document.getElementById("txt").style.display="block";? ?
? ? ? ? }可以回復(fù)初始值
xianyu_一些事一些情
用location.reload()方法。無參數(shù)或者參數(shù)為false,表明如果文檔已改變,重新加載該文檔。
我獲取初始值的方法是,通過confirm()返回一個(gè)boolean,然后boolean=true,放入if語句,然后獲取“txt”標(biāo)簽對象,對著前面css中的參數(shù),分別修改color,backgroundColor,width,height,display。
我開始想創(chuàng)建一個(gè)class,然后包含初始樣式,最后獲取class,然后修改。這樣在大工程中效果挺好,但是這個(gè)練習(xí)來說,這樣就可以了,笨方法有時(shí)卻是最有效的。
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答恢復(fù)初始值得 語句不會(huì) 沒見過 不懂
2 回答恢復(fù)初值不好使
6 回答恢復(fù)原始值
2 回答如何恢復(fù)原始值
4 回答怎么恢復(fù)原始值?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2015-05-11
用removeAttribute()這個(gè)方法也可以,用源碼中的那種方法也可以
2016-07-13
2016-04-21
調(diào)用函數(shù)
function add5(){
? ? ? ? var mar=confirm("取消設(shè)置?");
? ? ? ? if(mar==true){
? ? ? ? ? ? var mar=document.getElementById("txt").removeAttribute("style");
? ? ? ? ? ? // var mar=document.getElementById("txt").style.width="600px";
? ? ? ? ? ? // var mar=document.getElementById("txt").style.display="block";? ?
? ? ? ? }可以回復(fù)初始值
2016-04-17
用location.reload()方法。無參數(shù)或者參數(shù)為false,表明如果文檔已改變,重新加載該文檔。
2015-05-14
我獲取初始值的方法是,通過confirm()返回一個(gè)boolean,然后boolean=true,放入if語句,然后獲取“txt”標(biāo)簽對象,對著前面css中的參數(shù),分別修改color,backgroundColor,width,height,display。
我開始想創(chuàng)建一個(gè)class,然后包含初始樣式,最后獲取class,然后修改。這樣在大工程中效果挺好,但是這個(gè)練習(xí)來說,這樣就可以了,笨方法有時(shí)卻是最有效的。