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