removeAttribute的使用問題
題目我已經(jīng)做出來了、但是我想知道為什么不能用removeAttribute直接刪<body id="main">里面的JS樣式呢?
還是我這樣不行?
<body id="main">
...
main.removeAttribute("style");
removeAttribute只能一個(gè)個(gè)刪嗎?有沒有一個(gè)更好的方法呢、萬一有很多很多個(gè)樣式也要一個(gè)個(gè)的刪除嗎?
2016-07-15
舉報(bào)
2016-07-15
//定義"取消設(shè)置"的函數(shù)
? ? function cancelOper(){
? ? ? var mychar = confirm("是否取消設(shè)置?");
? ? ? if(mychar == true){
? ? ? ? divar.removeAttribute("style"); ?
? ? ? }
? ? }