Visualizzazione dei risultati da 1 a 3 su 3

Discussione: function parametrica

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    253

    function parametrica

    Ciao ragazzi,
    come faccio a rendere parametrica questa funzione per aprire i popup

    function finestra2()

    {

    var w = 550;
    var h = 413;
    var l = Math.floor((screen.width-w)/2);
    var t = Math.floor((screen.height-h)/2);


    window.open("pagina.htm","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);

    }

    la chiamata...
    <a href="javascript:finestra();">

    so che passo tre parametri alla function ossia nomepag, w,h ma poi come faccio a fare la chiamata?
    Vi ringrazio!

  2. #2
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,361
    function finestra2(w,h)

    {
    var l = Math.floor((screen.width-w)/2);
    var t = Math.floor((screen.height-h)/2);


    window.open("pagina.htm","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);

    }

    la chiamata...
    <a href="javascript:finestra(550,413);">

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    253
    grazie mille sei stato gentilissimo!
    Giustamente nond ovevo dare come parametro il nome della pagina ma solo altezza e larghezza..grazie!

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 © 2024 vBulletin Solutions, Inc. All rights reserved.