為什么我的確認框彈不出來呀
?function rest(){
? ? ? ? var mymessage=confirm("是否取消設置?");
? ? ? ? if(mymessage==true)
? ? ? ? mytxt.removeAttribute("style");
? ? }
?function rest(){
? ? ? ? var mymessage=confirm("是否取消設置?");
? ? ? ? if(mymessage==true)
? ? ? ? mytxt.removeAttribute("style");
? ? }
2016-11-19
舉報
2016-12-02
if判斷的時候是要括起來的,這樣才能判斷你的if語句。
2016-11-20
function rest()
? ? ?{
? ? ? ? var mymessage=confirm("是否取消設置?");
? ? ? ? if(mymessage==true)
? ? ? ?{
? ? ? ? ? var mytxt=document.getElementById("txt");? ? ? ??
? ? ? ? ? mytxt.removeAttribute("style");
? ? ? ?}
? ? ?}
2016-11-19
<body>
??? <script>
??????? //這是第一種方式加window.onload,你不必要深究這個問題,
??????? //window.onload意思就是在頁面刷新的加載的時候調用你聲明的函數:rest();
??????? //然后執行function(){? 代碼..... }里面寫的代碼
??????? window.onload = function () {
??????????? rest();
??????? }
??????? function rest() {
??????????? var mymessage = confirm("是否取消設置?");
??????????? if (mymessage == true)
??????????????? mytxt.removeAttribute("style");
??????? }
??????? //第二種就是不加window.onload,直接在函數下面寫rest();
??????? function rest() {
??????????? var mymessage = confirm("是否取消設置?");
??????????? if (mymessage == true)
??????????????? mytxt.removeAttribute("style");
??????? }
??????? rest();
?????? ?
??????? //就像一個妹子在吃飯 ,對面男生也是自己吃自己的,它就不會有什么(嘿哈拳頭斥候的動作):就像下面代碼:
??????? //function 函數名(){
??????? //代碼......
??????? //}
??????? //聲明是聲明函數
??????? //當那個男生用筷子夾肉肉給她吃的時候,她就笑瞇瞇的,它就會去找rest()這個函數,它就擁有執行權,觸發了這個rest()函數
??????? //rest();調用函數
????? ?
??? </script>
</body>