Javascript 如何禁用单击弹出窗口退出?

Javascript 如何禁用单击弹出窗口退出?,javascript,twitter-bootstrap,Javascript,Twitter Bootstrap,我在我的网站上创建了此弹出框: 使用以下代码: <div class="modal custom fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="mo

我在我的网站上创建了此弹出框:

使用以下代码:

<div class="modal custom fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Upload a Meme</h4>
        </div>
        <div class="modal-body">
            <div class="input-group">
                <input type="text" class="form-control" placeholder="Url: http://" id="urlInput">
                <input type="text" class="form-control" placeholder="Title" id="titleInput">
                <input id="saveComments" type="text" class="form-control" placeholder="Comments">
                <input type="text" class="form-control" placeholder="Tags" id="tagInput">
            </div>
            <br>
            <h4>&nbsp;Rate It:</h4>
            <div class="rating pull-left">
                <input type="radio" id="stars5" name="rating" value="5" /><label for="stars5" title="Rocks!">5 stars</label>
                <input type="radio" id="stars4" name="rating" value="4" /><label for="stars4" title="Pretty good">4 stars</label>
                <input type="radio" id="stars3" name="rating" value="3" /><label for="stars3" title="Meh">3 stars</label>
                <input type="radio" id="stars2" name="rating" value="2" /><label for="stars2" title="Kinda bad">2 stars</label>
                <input type="radio" id="stars1" name="rating" value="1" /><label for="stars1" title="Sucks big time">1 star</label>
            </div>
        </div>

        <div class="modal-footer">
            <button type="button" class="btn btn-default cancel" data-dismiss="modal">Cancel</button>
            <button type="button" class="btn btn-default submit" id="saveSubmit"><b>Submit</b></button>
        </div>
    </div>
</div>

&时代;接近
上传一个迷因

评分: 五星 四星 三星 双星 一颗星 取消 提交

我有一个取消按钮和一个提交按钮。取消按钮退出弹出窗口,但用户也可以在上载窗口外单击退出

如何防止单击框外退出


谢谢

尝试将这两个字符串添加到HTML元素中:
data background=“static”
data keyboard=“false”

将数据背景设置为静态,将数据键盘设置为false可能会解决您的问题


请看一看。它将为您提供解决方案

您必须发布代码以帮助mate。没有你的代码,这一切都只是猜测工作。好吧,我将编辑感谢uMarkup(HTML)单独将不够。您还需要显示CSS和Javascript。您使用的是引导库还是其他库?我认为如果您使用引导程序,则最好是使用a或a。如果使用引导程序,则看起来您正在使用引导程序:然后按照链接进行操作,前提是该链接提供了一些关于在弹出窗口外单击时防止关闭操作的答案