定義“取消設置”的函數,我這么設置怎么起不了作用呢?
function cancel(){
? ? var message=confirm("確定要取消設置么?")
? ? if(message=="true"){
? ? ? var pp=document.getElementById("txt");
? ? ? pp.style.width="600px";
? ? ? pp.style.height="400px";
? ? ? pp.style.color="#000";
? ? ? pp.style.backgroundColor="#fff";
? ? ? pp.style.display="block";
? ? }
}
2016-02-05
把true的雙引號去掉就行了
function cancel(){
? ? var message=confirm("確定要取消設置么?")
? ? if(message==true){
? ? ? var pp=document.getElementById("txt");
? ? ? pp.style.width="600px";
? ? ? pp.style.height="400px";
? ? ? pp.style.color="#000";
? ? ? pp.style.backgroundColor="#fff";
? ? ? pp.style.display="block";
? ? }
2016-02-05
問題解決了...是語法錯誤...
在confirm語句后面少了一個分號,以及對message的判斷語句把雙引號去掉。
代碼本身沒問題。
2016-02-05
試試修改方法名,我開始用”reset“做方法名沒反應,改成”resetStyle“就可以了