Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Problema con javascript

    Ciao ho creato un messaggio in javascript mettendo la funzione di ricarica della pagina questo è lo script:



    Codice PHP:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <
    head>
        <
    meta name="Keywords" content="javascript" />
        <
    script src="jquery-1.4.1.js" type="text/javascript"></script>



        <script src="jquery.msgBox.js" type="text/javascript"></script>

        <link href="msgBoxLight.css" rel="stylesheet" type="text/css" />
        <link href="styles.css" rel="stylesheet" type="text/css" />


        

        
        
     <script type="text/javascript">

     
     
     
            $(function () {

                $(window).scroll(function () {

                    var top = $(window).scrollTop();

                    $("div.social").css({ position: (top > 260 ? "fixed" : "absolute"), top: top > 260 ? 10 : 260 });

                });

            });

        </script>



        <script type="text/javascript">

            function setCodeView(mainCode) {

                var code = mainCode.split('');

                var temp = "";

                var spanRed = "<span style=\"color:red;\">";

                var spanGreen = "<span style=\"color:green;\">";

                var spanClose = "</span>";

                var isOpen = false;

                var lastIndex = 0;

                for (var i = 0; i < code.length; i++) {

                    if (code[i] == '"' || code[i] == '\'') {

                        temp += (isOpen ? code[i] + spanClose : spanRed + code[i]);

                        lastIndex = i;

                        isOpen = !isOpen;

                    }

                    else if (code[i] == ',' || code[i] == ':' || code[i] == '{' || code[i] == '}') {

                        temp += spanGreen + code[i] + spanClose;

                    }

                    else if (code[i] == '<') {

                        temp += "&#060";

                    }

                    else if (code[i] == '>') {

                        temp += "&#062";

                    }

                    else if (code[i] == '\n') {

                        temp += i == 0 ? "" : (i == code.length - 1 ? "" : "
    ");

                    }

                    else if (code[i] == ' ') {

                        temp += ' ';

                    }

                    else {

                        temp += code[i];

                    }

                }

                return temp;

            }



            function SetCodeBlocks() {

                $("div.codeBlock>code").each(function (index, domEle) {

                    var code = setCodeView($(this).html());

                    $(this).html(code);

                });

            }

            $(function () {

                SetCodeBlocks();

            });

        </script>



        <script type="text/javascript">


            function example4() {

                $.msgBox({

                    title: "Ooops.. Sito in manutenzione",

                    content: "Ci scusiamo per gli eventuali errori, il nostro è momentaneamente OFF..
     A causa di aggiornamenti 
       <div class='buttonBlock'>

    <input type='button' onclick='refresh()' value='Ricarica Pagina'name='button1'></p></div>",

                    type: "error",

                    

                });

            }

                
                        










            function example7() {

                $.msgBox({ type: "prompt",

                    title: "Log In",

                    inputs: [

                    { header: "User Name", type: "text", name: "userName" },

                    { header: "Password", type: "password", name: "password" },

                    { header: "Remember me", type: "checkbox", name: "rememberMe", value: "theValue"}],

                    buttons: [

                    { value: "Login" }, { value: "Cancel"}],

                    success: function (result, values) {

                        var v = result + " has been clicked\n";

                        $(values).each(function (index, input) {

                            v += input.name + " : " + input.value + 

                            (input.checked != null ? (" - checked: " + input.checked) : "") + "\n";

                        });

                        alert(v);

                    }

                });

            }

        </script>





        </head>
    <body>





     

    <div class="buttonBlock">

        <input type="button" value="Example 4" onClick="example4();"/>

    </div>





    </body>
    </html>








    <html>

    <head>
    <script language="JavaScript">
    <!--

    //  The "refresh" function implementations are identical
    //  to our regular "JavaScript-Refresh" example.  The only
    //  difference from our JavaScript Refresh example is
    //  we do not have a doLoad function that starts our
    //  refresh timer (since we use a refresh button).

    var sURL = unescape(window.location.pathname);

    function refresh()
    {
        window.location.href = sURL;
    }
    //-->
    </script>

    <script language="JavaScript1.1">
    <!--
    function refresh()
    {
        window.location.replace( sURL );
    }
    //-->
    </script>

    <script language="JavaScript1.2">
    <!--
    function refresh()
    {
        window.location.reload( false );
    }
    //-->
    </script>
    </head>

    <body>



                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </body>

    </html> 
    Lo voglio aprire senza un bottone cioè al caricamento della pagina solo che questo messaggio si apre con il bottone o provato ad inserire un alert ma non lo da, lo ho provate con tutte cosa posso fare?
    Aiutatemi..

  2. #2
    fai semplicemente <body onload='example4()'>

  3. #3
    Wow grazie non ci avevo mai pensato..
    Avvolte le cose più semplici sono le più difficili da trovare ..XD

  4. #4
    Originariamente inviato da frankin0
    Wow grazie non ci avevo mai pensato..
    Avvolte le cose più semplici sono le più difficili da trovare ..XD
    True story bro

  5. #5

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.