我在 Flash 站点中有一个 html 表单。表单是 php 处理的。帮助我修复 php 文件,以便在处理表单后,php 将用户返回到 flash 页面并重新加载 html 表单。我在 php 中尝试了一个 window.location 来发送到页面但是那没有用。它会在 html 代码区域内产生一个白色矩形(可能是框架,但我不确定)。我怎样才能重新加载那个 html 表单?我不想使用 URL 加载整个页面,因为那样太慢而且我无法复制闪存状态。顺便说一句,下面是简化代码的精简版本。
网址: http://www.wix.com/efficertain/efficertainaccounting/accounting
表单代码:
姓名
电话
最佳通话时间
PHP代码:
$mail_to = 'info@efficertain.ca';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_phone."\n";
$body_message .= 'Message: '.$field_when;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'http://www.wix.com/efficertain/efficertainaccounting/accounting';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to info@efficertain.ca');
window.location = 'http://www.wix.com/efficertain/efficertainaccounting/accounting';
</script>
<?php
}
?>
最佳答案
您不应在此处使用 window.location
,因为它会重新加载整个浏览器窗口。尝试使用 document.location
,您需要将表单的 URL 传递给它而不是整个页面的 URL,因为您只想重新加载 iframe 内容。因此,根据上面的示例,您的 URL 将是 http://www.flashquix.com/embeds/fb4c83282b9342aa83952e74ad33dfdd?wrap=no&gzip=true&bg=transparent
。
document.location = 'http://www.flashquix.com/embeds/fb4c83282b9342aa83952e74ad33dfdd?wrap=no&gzip=true&bg=transparent';
关于php - Javascript,HP 在没有 URL 的警报后重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8981992/