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

    risoluzione video e sfondo pagina

    CIao io uso uno script per sapere la risoluzione dell schermo dell' utente, e vorre in base al dato width = screen.width e al dato height = screen.height caricare uno sfondo diverso nella pagina html.
    Ma non so come posso fare?
    Vi posto qui il codice delal pagina in questione...grazie a choiunque mi possa essere di aiuto:

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">


    <!-- Activate Cloaking Device





    // Used to display the browser name/version if JavaScript1.2 is not supported

    var browser=navigator.appName + " " + navigator.appVersion;



    // Though set in the JS1.2 code, these variables are declared here to avoid errors in lesser browsers

    var width=null;

    var height=null;

    var right_browser=false;



    // Called by Requirements button

    function aboutScheme()

    {

    alert("\nThis example uses screen.height & screen.width to grab the screen resolution.\n\nThese were introduced in JavaScript1.2.");

    }



    // Called by View Source button - displays text file of source.

    function viewSource()

    {

    alert("\nA text file with source will be loaded to the full window.\n\nUse your browser BACK button to return to the examples.");

    top.window.location.href="js-wid3.txt";

    }



    // Deactivate Cloaking -->


    </SCRIPT>





    <SCRIPT LANGUAGE="JavaScript1.2">


    <!-- Activate Cloaking Device



    // Used to indicate that JS1.2 is supported

    right_browser=true;



    // Grabs screen resolution

    width = screen.width;

    height = screen.height;



    // Deactivate Cloaking -->


    </SCRIPT>


    </HEAD>

    <body background="../../Documenti/illusion-gruop/Senza titolo-1.jpg" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" bgproperties="fixed" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Activate Cloaking Device



    // If browser supports JS1.2

    if(right_browser)

    {

    document.open();

    document.write("<CENTER><FONT SIZE='+1'>La risoluzione del tuo video e'
    ");

    document.write(width + " x " + height);

    document.write("
    </FONT></CENTER>");

    }



    // If browser does not support JS1.2 - display browser name/version & message

    else

    {

    document.open();

    document.write("<CENTER>");

    document.write("<FONT SIZE='+1'>"+browser+"</FONT>

    ");

    document.write("<FONT SIZE='+1'>does not support JavaScript1.2.</FONT></CENTER>");

    }



    // Deactivate Cloaking -->

    </SCRIPT>

    </BODY>

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2006
    Messaggi
    4
    codice:
    <script language="javascript" type="text/javascript">
    <!--
    
      if (document.all || document.layers || document.getElementById || window.opera)
      {
        var imageSrc = "";
    
        if (screen.width == 640 && screen.height == 480)
          imageSrc = "piccolo.jpg";
    
        else if (screen.width == 800 && screen.height == 600)
          imageSrc = "medio.jpg";
    
        else if (screen.width == 1024 && screen.height == 768)
          imageSrc = "grande.jpg";
    
        else
          imageSrc = "altro.jpg";
    
        document.writeln ("<body background=\"" + imageSrc + "\">");
      } else
        document.writeln ("Errore fatale: Il browser " + navigator.appName + " non supporta JavaScript1.2.");
    
    //-->
    </script>
    lo metti prima di </head>

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.