[英]Redirect PHP Page Using Javascript
<form action="" method="POST" onClick="submit" name="Formular">
<font face="Arial">VID:</font>
<input type="text" name="ID" size="6">
<input type="submit" value="Go" name="B1">
</form>
<?php //Form.php
//ID
if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID']))
{
header("LOCATION: http://www.site.org/members/person/details.asp?Id=".(int)$_REQUEST['ID']);
exit;
}
?>
使用这种形式,我想做一个iFrame或在JavaScript中打开一个新窗口。 我怎样才能做到这一点?
如果您想使用JavaScript重定向而不是php重定向,请更改以下内容:
if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID']))
{
header("LOCATION: http://www.site.org/members/person/details.asp?Id=".(int)$_REQUEST['ID']);
exit;
}
对此:
if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID']))
{
?>
<script>
self.location='http://www.site.org/members/person/details.asp?Id='+<?=$_REQUEST['ID']?>;
</script>
<?php
}
if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID']))
{
?>
<script>
window.location='http://www.site.org/members/person/details.asp?Id='+<?=$_REQUEST['ID']?>;
</script>
<?php
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.