duanqin9631 2013-04-29 23:17
浏览 36

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

I have a php script in which there is a meta tag which refreshes a part of the script (checking connectivity of an IP). While it does it, it outputs some status text like "checking connectivity, 5/10 retries".

I've added a stop-button to the end of that, so I can stop the refresh-procedure mid-way if i need to. Problem is that it only seems to stop the current "load", not the whole refresh-procedure.

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

This is a code snippet from the php script:

function htmlheader( )
{
global $device, $frame, $tries, $maxtries, $status, $pageurl, $timeout;
// global "custom" header settings
$content = "<TITLE>PHP WoL ($device) - by PRThomasUK </TITLE>
";
//generate refresh header for frame2.
if ( $status == 0 ) {
$content .= "<META HTTP-EQUIV=\"refresh\" CONTENT=\"$timeout;url=$pageurl?&tries=$tries\">
";
}
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>
";
$content .= "<p>Checking connectivity... ($tries/$maxtries) &nbsp;&nbsp;&nbsp<a href=\"\" onclick=\"stopFrameLoad(); return false;\">Stop</a></p>
";
}

This is the JS isolated:

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

And the actual line thats outputted:

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

1条回答 默认 最新

  • duanchun1852 2013-04-29 23:23
    关注

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

    By not outputting the META tag in the first place.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题