簡體   English   中英

JS不能間接執行

[英]JS does not work indirect execution

我有這個js代碼,可以完美地與雙擊配合使用,但是當我嘗試將其合並到另一個文件中時,它將無法正常工作。 該代碼應在單擊按鈕時顯示POP向上窗口。 在第二種情況下,問題在於應該在彈出窗口中顯示的內容直接在瀏覽器中顯示,並且在單擊按鈕時什么也沒有發生。 有人有經驗嗎?

<!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');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM