Re: [請益] 關於彈跳視窗~
※ 引述《timmilk (討厭的態度)》之銘言:
: 不好意思 再請問一下
: 下面是我用來測試的程式碼
: <body>
: <form name="form1" method="post" action="">
: <p>
: <input type="text" name="textfield">
: <?php
: if($textfield=="") //如果textfield是空值
: echo "<script>alert('未填寫');history.go(-1);</script>";
: ?>
: <input type="submit" name="Submit" value="送出">
: </p>
: </form>
: </body>
: 我沒有寫在<body onLoad='這個地方'>
: 可是我載入頁面的時候 彈跳視窗就已經先跳一次了
: 我該怎麼解決Orz
這就是你把server端語言(php)和client端語言(js)搞混了
server端語言從來就不能跑到一半去「呼叫」client端函式
像這種檢查其實只需要純js就可以搞定了的
詳細寫法可以去google或dob上去搜尋
--
'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done
one thing to make absolutely sure that every single person in this school
will read your interview, it was banning it!'
---'Harry Potter and the order of the phoenix', P513
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 192.192.197.115
討論串 (同標題文章)