作者LPH66 (凉宫春日症候群)
看板PHP
标题Re: [请益] 关於弹跳视窗~
时间Sat Jan 6 17:30:51 2007
※ 引述《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