dongyun7571 2019-02-23 00:43
浏览 104

调用从PHP呈现的JS函数

I’m unable to invoke the JS function being rendered from my PHP code, which is supposed to redirect the user after a specified duration.

first I'm not a programmer or coder, so I'm searching here for help to correct maybe a corrupted redirecting code, I used along ago but it doesn't work now. Maybe there is something changed in the code without I know.

<?php
if(isset($_GET['url'])){
    if(isset($_GET['d']) && $_GET['d'] == 1){
        $TheFullURL = '<a href="'.base64_decode($_GET['url']).'"><b><span style="font-size:10pt;"><font color="red">Download Here</font></span></b></a>';
    }else{
        $TheFullURL = '<a href="?url='.$_GET['url'].'&d=1"><b><span style="font-size:10pt;"><font color="red">Click Here</font></span></b></a>';
    }
    
    //--------By:hadutta.com --------//
    $wait_time = 15 ;
    $TheFullURL = '<!-- By:hadutta.com -->
        <div id="waiting_FullURL" >Please Wait ...</div>
        <script type="text/javascript">
        <!--
                function FullURL(secs){
                    secs--;
                    if(secs>0){
                        document.getElementById("waiting_FullURL").innerHTML = \'Please Wait ...\' + secs
                        window.setTimeout("FullURL("+secs+");",6000);
                    } else {
                        document.getElementById("waiting_FullURL").innerHTML = \''.$TheFullURL.'\';          
                    }
                }
        FullURL('.$wait_time.');    
        // -->
        </script>
}
?>   

please, help I've no idea about coding, I'm just a user. Thanks

</div>
  • 写回答

1条回答 默认 最新

  • drr47973 2019-02-23 01:41
    关注

    You forget to close your variable, and display the contents of the $TheFullURL

    <?php
    if(isset($_GET['url'])){
        if(isset($_GET['d']) && $_GET['d'] == 1){
            $TheFullURL = '<a href="'.$_GET['url'].'"><b><span style="font-size:10pt;"><font color="red">Download Here</font></span></b></a>';
        }else{
            $TheFullURL = '<a href="?url='.$_GET['url'].'&d=1"><b><span style="font-size:10pt;"><font color="red">Click Here</font></span></b></a>';
            //--------By:hadutta.com --------//
            $wait_time = 15 ;
            $TheFullURL = '<!-- By:hadutta.com -->
                <div id="waiting_FullURL" >Please Wait ...</div>
                <script type="text/javascript">
                <!--
                        function FullURL(secs){
                            secs--;
                            if(secs>0){
                                document.getElementById("waiting_FullURL").innerHTML = \'Please Wait ...\' + secs
                                window.setTimeout("FullURL("+secs+");",1000);
                            } else {
                                document.getElementById("waiting_FullURL").innerHTML = \''.$TheFullURL.'\';          
                            }
                        }
                FullURL('.$wait_time.');    
                // -->
                </script>';
        }
        echo $TheFullURL;
    }
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算