[英]Javascript PHP a pop up image appear when click on search, after close image display search results
我想使用javascript做一个“弹出图像”以显示一个简单的用户指南图像,在用户单击搜索后,图像会弹出,以使他们对结果有更好的理解。 因此,当用户关闭图像时,它们将链接到results.php。 抱歉,我无法提供任何有用的JavaScript代码,因为我从互联网上找到的代码太长。 而且我对JavaScript非常了解。
保存发布->会话
<?php
$loan_amt = $_POST['loan_amt'];
if($_POST['search']){
if($_POST['loan_amt']=="" || $_POST['loan_tenure']==""){
$error = "Please fill up the mandatory fields";
}else{
session_start();
$_SESSION['property_type'] = $_POST['property_type'];
$_SESSION['property_status'] = $_POST['property_status'];
$_SESSION['loan_amt'] = $_POST['loan_amt'];
$_SESSION['loan_tenure'] = $_POST['loan_tenure'];
header("location:rates_result.php");
}
}
?>
搜索表(贷款金额字段)
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="this.loan_amt.value=this.loan_amt.value.replace(/\,/g,'')">
<table width="400px">
<tr>
<td class="color1" width="130">Loan Amt (SGD)*:</td>
<td width="258" align="left">
<input type="text" style="width:150px;font-size:16px" onkeyup="format(this)" onchange="format(this)"
onblur="if(this.value.indexOf('.')==-1)this.value=this.value" name="loan_amt">
</td>
<td width="258" align="left"><input type="submit" class="buttonStyle" name="search" value="search" /></td>
</tr>
</table>
</form>
在弹出页面中,您可以在以下部分中输入:
<script type="text/javascript">
window.onclose=goToResults
function goToResults(){
//do the parent go to results.php
parent.location="results.php";
}
</script>
如果要提交表单,则可以将函数指向父对象,该函数可以提交表单:
在弹出窗口中:
function goToResults(){
//do the parent go to results.php
parent.submitForm();
}
在页面中:
function sumbitForm(){
form_to_submit=document.getElementById("FORM_ID");
form_to_submit.submit();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.