php - 暂时禁用/停止元标记刷新的按钮?

标签 php javascript button iframe

我有一个 php 脚本,其中有一个元标记,可以刷新脚本的一部分(检查 IP 的连接性)。当它执行此操作时,它会输出一些状态文本,例如“检查连接,5/10 重试”。

我在其末尾添加了一个停止按钮,因此如果需要,我可以中途停止刷新过程。问题是它似乎只停止当前的“加载”,而不是整个刷新过程。

如何使其暂时禁用/停止刷新?

这是 php 脚本中的代码片段:

function htmlheader( )
{
global $device, $frame, $tries, $maxtries, $status, $pageurl, $timeout;
// global "custom" header settings
$content = "<TITLE>PHP WoL ($device) - by PRThomasUK </TITLE>\n";
//generate refresh header for frame2.
if ( $status == 0 ) {
$content .= "<META HTTP-EQUIV=\"refresh\" CONTENT=\"$timeout;url=$pageurl?&tries=$tries\">\n";
}
return $content;
}
// function htmlheader( ) - Returns HTML content for mainpage, frame1 & frame2 based on value of $frame.
function htmlcontent( )
{
global $pageurl, $device, $deviceip, $deviceport, $devicemac1, $devicemac2, $frame, $tries, $maxtries, $status;
if ( $frame == 1 ) {
if ( $status == 0 ) {
$content = "<script type=\"text/javascript\">function stopFrameload() { window.stop(); document.execCommand(\"Stop\");}</script>\n";
$content .= "<p>Checking connectivity... ($tries/$maxtries) &nbsp;&nbsp;&nbsp<a href=\"\" onclick=\"stopFrameLoad(); return false;\">Stop</a></p>\n";
}

这是隔离出来的JS:

<script type="text/javascript">
function stopFrameload() {
window.stop();
document.execCommand("Stop");
}
</script>

实际输出的行:

<p>Checking connectivity... ($tries/$maxtries) &nbsp;&nbsp;&nbsp<a href="" onclick="stopFrameLoad(); return false;">Stop</a></p>

最佳答案

How can I make it temporarily disable/stop the refresh?

首先不输出 META 标记。

关于php - 暂时禁用/停止元标记刷新的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16289798/

相关文章:

javascript - 时间序列和聚合框架(mongo)

Iphone 默认键盘 "Go"按钮操作不适用于 PhoneGap

c# - WPF按钮点击事件

php - 发生客户端错误 : Could not create storage directory:/tmp/Google_Client/00

javascript - jQuery 动画数字计数器从零到值 - 当值达到数十万时计数器显示错误值

javascript - 要求和导入显示不同的行为。为什么会这样?

button - 我在哪里可以找到更改集中的按钮覆盖

php exec mysql 命令 - 不同的版本

php - 使用 ajax jquery 和 php 将 sortable 保存到 mysql

php - 在PHP中应用JS onmouseover效果