我有这三个函数,该怎么做呢在onload时一个接一个地调用它们在refresh时一次调用一个函数

I have these three function, what to do call them on onload one by one on refresh one function call at a time

本文关键字:一个 函数 调用 一次 refresh 三个 onload      更新时间:2023-09-26

我有三个函数的弹出。我想让它们一个接一个地在onload/refresh上调用在刷新弹出改变告诉我的解决方案,我可以使用这个过程中每次刷新函数调用。但是每次一个刷新下一个。我尝试使用数组和随机标记,但未能运行此。

<html>
<head>
    <title>four popup ads js used</title>
    <link type="text/css" rel="stylesheet" href="popup.css">
    <script src="jquery-1.2.6.min.js" type="text/javascript"></script>
    <script src="popup.js" type="text/javascript"></script>
    <script type="text/javascript">
        // Bottom  Popup JS//
        $(document).ready(function () {
            // When site loaded, load the Popupbox First
            loadPopupBox();
            $('#popupBoxClose').click(function () {
                unloadPopupBox();
            });
            $('#container').click(function () {
                unloadPopupBox();
            });
            function unloadPopupBox() {    // TO Unload the Popupbox
                $('#popup_box').fadeOut("slow");
                $("#container").css({ // this is just for style
                    "opacity": "1"
                });
            }
            function loadPopupBox() {    // To Load the Popupbox
                $('#popup_box').fadeIn("slow");
                $("#container").css({ // this is just for style
                    "opacity": "0.6"
                });
            }
        });
        // Transparent popup JS//
        $(document).ready(function () {
            $("p").click(function () {
                $("#div1").fadeOut();
            });
        });
        //  onclick  popup Under//
        var win = null;
        function NewWindow(mypage, myname, w, h, scroll, pos) {
            if (pos == "random") {
                LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100; TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
            }
            if (pos == "center") {
                LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100; TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
            }
            else if ((pos != "center" && pos != "random") || pos == null) { LeftPosition = 0; TopPosition = 20 }
            settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
            win = window.open(mypage, myname, settings);
        }
    </script>
</head>
<body>
    <div id="div1" style="background-color:gray;height:650px;width:81%;position:relative;">
        <div id="popup_box">
            <div class="small_box">You May Like This <img src="close.jpeg" id="popupBoxClose" height=20 width=15></div>
            <div>
                <br>
                <div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-1.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>Just click  on it</span></a></div>
                <div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-2.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>just click on it  </span></a></div>
                <div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-2.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>Just click on it  </span></a></div>
                <div style="float:left;"><a href=""><img src="slider-3.jpg" height=63><span style="float:right"><br>IT's Only for U <br>Just click on it</span></a></div>
            </div>
        </div>
    </div>
</body>
</html>

我只想在刷新时逐一调用该页面的所有函数

可以这样使用。

HTML页面

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jQuery UI Dialog - Default functionality</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
    <link rel="stylesheet" href="StyleSheet.css">
</head>
<body>
    <h4>Test Loaded</h4>
    <div id="dialogA" class="box" title="Basic dialog">
        <h1>dialogA</h1>
        <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
    <div id="dialogB" class="box" title="Basic dialog">
        <h1>dialogB</h1>
        <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
    <div id="dialogC" class="box" title="Basic dialog">
        <h1>dialogC</h1>
        <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
    <div id="dialogD" class="box" title="Basic dialog">
        <h1>dialogD</h1>
        <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
    <script src="JavaScript.js" type="text/javascript"></script>
</body>
</html>

CSS文件 StyleSheet.css

#dialogA, #dialogB, #dialogC, #dialogD {
    /*display: none;*/
}
.box {
    display: none;
}

JavaScript File JavaScript.js

var textToShow = ['#dialogA', '#dialogB', '#dialogC', '#dialogD']; //add the div ID as an array
var resultID = textToShow[Math.floor(Math.random() * textToShow.length)]; //get the random Id from the array
//alert(resultID);//Debug the Div ID
loadPopup(resultID);//Pass the ID to the function
function loadPopup(resultID) {
    switch(resultID) {
        case '#dialogA':
            //alert('#dialogA');//Debuging
            $(resultID).dialog({ height: '100px', width: '20px' });//custom width and height
            break;
        case '#dialogB':
            //alert('#dialogB');//Debuging
            $(resultID).dialog({ height: '200px', width: '120px' });//custom width and height
            break;
        case '#dialogC':
            //alert('#dialogC');//Debuging
            $(resultID).dialog({ height: '300px', width: '220px' });//custom width and height
            break;
        case '#dialogD':
            //alert('#dialogD');//Debuging
            $(resultID).dialog({ height: '400px', width: '320px' });//custom width and height
            break;
        default:
            //alert('default');//Debuging
            $(resultID).dialog();//Default width and height will be reffer
    }
}

如果你需要我的帮助。

请通过搜索yeshansachithak为我找到任何一个社交网络。