JS不支持间接执行



我有这个js代码,它可以完美地双击,但当我试图将它合并到另一个文件中时,它不起作用。该代码应该在单击按钮时显示一个弹出窗口。第二种情况下的问题是,应该在弹出窗口中显示的内容直接显示在浏览器中,单击按钮时不会发生任何事情。有人有这方面的经验吗?

<!doctype html>
<html>
    <head>
        <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
        <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
        <script>
            $(document).ready(function(){
                $( "#hello" ).dialog({ autoOpen: false });
                $( "#say_it" ).click(function() {
                    $( "#hello" ).dialog( "open" );
                });
            });
        </script>
    </head>
    <body>
        <p>This page wants to say "Hello!"<br>
        Be nice and press the button.</p>
        <button id="say_it">Say "Hello!"</button>
        <div id="hello" title="Hello  World!"><p><font face="Georgia" size="4">
        Hey, world, I just said "Hello!"</font></p></div>
    </body>
</html>

是一个用样式模拟弹出窗口的库,当前窗口的弹出也是如此

带有Jquery ui 的内部弹出窗口

$('.some').dialog( "open" );

它是外部弹出

prompt("Please enter your name", "Harry Potter");

另一个

alert('other popup');

和另一个

window.open('popup.html');

相关内容

最新更新