繁体   English   中英

根据出现类似以下情况的条件自动显示弹出窗口:当我获得URL http:// localhost:81 / Try / demo?result = false时

[英]Automatic appear the popup window based on condition like When i get the url http://localhost:81/Try/demo?result=false

在出现类似http:// localhost:81 / Try / demo?result = false的条件时,会自动出现弹出窗口。 在示例代码下面,我正在使用colorBox弹出窗口。 当我单击链接内联HTML时,它将显示弹出窗口。 如果PHP中的($ _REQUEST ['result'] == false),我需要自动弹出

<script src="../jquery.colorbox.js"></script>
<script>
    $(document).ready(function(){               
        $(".inline").colorbox({inline:true, width:"50%"});              
    });
</script>
</head>
<body>
    <h1>WELCOME</h1>
        <p><a class='inline' href="#inline_content">Inline HTML</a></p>

        <!-- This contains the hidden content for inline calls -->
        <div style='display:none'>
            <div id='inline_content' style='padding:10px; background:#fff;'>
            <p><strong>This content comes from a hidden element on this  page.</strong>
           </p>
            <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.</p>          
            <a href="download.csv">Click here to download file</a></p>
            </div>
        </div>
</body>

我不知道您所说的“弹出”是什么意思,但是如果“结果”为假,这是如何在JavaScript中执行操作。

<script>
    <?php if($_REQUEST["result"]=="false") {
        echo "alert('result is false')";
    }?>
</script>

也可以像这样在JavaScript中执行此操作:

if (document.location.query.indexOf('result=false') !== -1) {
  alert('result is false');
}

如果要显示整个模态(例如,Bootstrap Modal,jQuery UI Modal,custom等),则需要某种模态实现。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM