Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295

    apertura popup con la index! aiuto

    <script language="Javascript">
    <!--
    newwindow=window.open('pagina.htm', '', 'width=145,height=50,scrollbars=no')
    window.opener=self
    -->
    </script>



    questo codice serve per aprire un popup in contemporanea con la index.
    io dovrei far aprire insieme all'apertura della mia index la popup dell'esempio 2 del sito http://digilander.libero.it/wstandar...dardpopup.html
    come modifico quel codice?
    grazie
    sara

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    4,127
    cerca il tag <body>


    lo cancelli
    e ci metti:

    codice:
    <body onload="window.open('pagina.htm', '', 'width=145,height=50,scrollbars=no')">
    cmq argomento trito e ritrito
    :maLOL:

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    forse non mi sono spiegata bene:
    voglio aprire in contemporanea con la index un popup come nell'esempio 2 del link: cioè una popup che parte dall angolo in basso a destra del monitor e va a finire all'angolo superiore sinistro con apertura.
    grazie
    sara

  4. #4
    Utente bannato
    Registrato dal
    Jan 2002
    Messaggi
    852
    <script type="text/javascript">

    /////////////////////////////////////////////
    /// ///
    /// creato da standard © 2002 ///
    /// ///
    /// con la collaborazione di kronik ///
    /// ///
    /////////////////////////////////////////////


    function initleft(valleft,valwidth) {
    if(typeof(valleft)== "string") {
    switch(valleft) {
    case "left": retleft = 0; break;
    case "center": retleft = (screen.width - valwidth)/2; break;
    case "right": retleft = screen.width - valwidth; break;
    default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
    }
    }
    else retleft = valleft
    return(retleft)
    }


    function inittop(valtop,valheight) {
    if(typeof(valtop)== "string") {
    switch(valtop) {
    case "top": rettop = 0; break;
    case "center": rettop = (screen.height - valheight)/2; break;
    case "bottom": rettop = screen.height - valheight; break;
    default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
    }
    }
    else rettop = valtop
    return(rettop)
    }


    function initpassitot() {
    this.passitot = Math.round(Math.max(Math.abs((this.fw-this.iw))/Math.abs(this.passow),Math.abs((this.fh-this.ih))/Math.abs(this.passoh)))

    if(!this.passitot || this.passitot==0)
    this.passitot = Math.round(Math.max(Math.abs((this.fl-this.il))/Math.abs(this.passow),Math.abs((this.ft-this.it))/Math.abs(this.passoh)))
    }


    function popplay() {

    if(!this.pp.closed){

    this.pp.focus()

    if(this.ciclo < this.passitot) {
    opw = (this.passow > 0) ? "<" : ">" ;
    oph = (this.passoh > 0) ? "<" : ">" ;

    if(eval("this.iw "+opw+" this.fw")) this.iw += this.passow
    if(eval("this.ih "+oph+" this.fh")) this.ih += this.passoh

    this.il += this.passol
    this.it += this.passot
    this.pp.resizeTo(this.iw,this.ih)
    this.pp.moveTo(this.il,this.it)
    this.ciclo++
    eval("setTimeout(this.obj+'.play()',"+this.ms+")")
    }
    else {
    this.ciclo = 0
    eval(this.af)
    }
    }
    }


    function popslide(fw,fh,fileft,fitop,passow,passoh,ms,af,no slide){

    this.fw = (fw == "max") ? screen.width : (fw || this.iw);
    this.fh = (fh == "max") ? screen.height : (fh || this.ih);
    this.fl = (fileft) ? initleft(fileft,this.fw) : initleft(this.inleft,this.fw);
    this.ft = (fitop) ? inittop(fitop,this.fh) : inittop(this.intop,this.fh);
    this.inleft = fileft || this.inleft;
    this.intop = fitop || this.intop;
    this.passow = (this.fw - this.iw >=0) ? (passow || 10) : eval("-"+(passow || 10));
    this.passoh = (this.fh - this.ih >=0) ? (passoh || 10) : eval("-"+(passoh || 10));
    this.passi()
    this.passol = (this.fl - this.il)/this.passitot
    this.passot = (this.ft - this.it)/this.passitot
    this.ms = ms || 10;
    this.af = af || ''
    if(!noslide) this.play()
    }


    function pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft ,fitop,passow,passoh,ms,af,noslide) {
    this.obj = nome
    this.iw = (iw == "max") ? screen.width : iw;
    this.ih = (ih == "max") ? screen.height : ih;

    this.il = initleft(inleft,this.iw)
    this.it = inittop(intop,this.ih)

    tools = tools || '';
    if(document.layers)
    tools = (tools.toLowerCase().indexOf("resizable")==-1) ? 'resizable=yes,'+tools : tools;

    this.pp = window.open(url,nome,tools+" width=100,height=100,left="+this.il+",top="+this.i t)
    this.pp.resizeTo(this.iw,this.ih)
    this.ciclo = 0

    this.inleft = inleft
    this.intop = intop
    this.slide(fw,fh,fileft,fitop,passow,passoh,ms,af, noslide)

    }



    function popclose() {
    this.pp.close()
    }


    function poplocation(url) {
    this.pp.location = url
    this.pp.focus()
    }


    function addpop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fil eft,fitop,passow,passoh,ms,af,noslide) {
    eval(nome+" = new pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft ,fitop,passow,passoh,ms,af,noslide);")
    }


    pop.prototype.passi = initpassitot
    pop.prototype.slide = popslide
    pop.prototype.play = popplay
    pop.prototype.close = popclose
    pop.prototype.location = poplocation

    ////////////////////////////////////////////////////////////
    /// funzioni per l'interfaccia

    function valore(radio,text) {
    var val
    var rad = false
    for(i=0; i< document.setta["R"+radio].length; i++)
    if(document.setta["R"+radio][i].checked)
    {val = document.setta["R"+radio][i].value;
    rad = true;}
    if(!rad) val = eval(document.setta["T"+text].value) || null;
    return(val)
    }


    function setarea(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,i ntopf,fileftf,fitopf,passowf,passohf,msf,aff) {
    if(tools!=null) tools = "'"+tools+"'"
    if(typeof(iwf)=="string") iwf="'max'"
    if(typeof(ihf)=="string") ihf="'max'"
    if(typeof(fwf)=="string") fwf="'max'"
    if(typeof(fhf)=="string") fhf="'max'"
    if(typeof(inleftf)=="string") inleftf="'"+inleftf+"'"
    if(typeof(intopf)=="string") intopf="'"+intopf+"'"
    if(typeof(fileftf)=="string") fileftf="'"+fileftf+"'"
    if(typeof(fitopf)=="string") fitopf="'"+fitopf+"'"

    document.setta.S1.value = ""
    newaction = null
    if(aff) {
    document.setta.S1.value = "newaction = \""+aff+"\"\n"
    newaction = "newaction"
    }

    document.setta.S1.value += "addpop('"+nomef+"','"+urlf+"',"+tools+","+iwf+"," +ihf+","+fwf+","+fhf+","+inleftf+","+intopf+","+fi leftf+","+fitopf+","+passowf+","+passohf+","+msf+" ,"+newaction+",null)"
    }



    function verifica() {
    var errore=false;
    if (document.setta.T1.value =='') errore=true; else nomef = document.setta.T1.value;

    urlf = document.setta.T2.value || '' ;
    tools = document.setta.T2b.value || null;

    if (document.setta.T3.value =='') errore=true;
    else iwf = (document.setta.T3.value=='max') ? iwf = 'max' : eval(document.setta.T3.value);
    if (document.setta.T4.value =='') errore=true;
    else ihf = (document.setta.T4.value=='max') ? ihf = 'max' : eval(document.setta.T4.value);

    inleftf = valore(1,5); if(inleftf == null) errore=true;
    intopf = valore(2,6); if(intopf == null) errore=true;

    fwf = (document.setta.T7.value=='max') ? fwf = 'max' : (eval(document.setta.T7.value) || null);
    fhf = (document.setta.T8.value=='max') ? fhf = 'max' : (eval(document.setta.T8.value) || null);

    fileftf = valore(3,9);
    fitopf = valore(4,10);

    passowf = eval(document.setta.T11.value) || null;
    passohf = eval(document.setta.T12.value) || null;

    msf = eval(document.setta.T13.value) || null;
    aff = document.setta.T14.value || null;
    if(!errore) {
    setarea(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,i ntopf,fileftf,fitopf,passowf,passohf,msf,aff)
    addpop(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,in topf,fileftf,fitopf,passowf,passohf,msf,aff);
    }
    else alert("ERRORE NELLA COMPILAZIONE DEL FORM")
    }

    function nocheck(indice) {
    for(i=0; i<document.setta["R"+indice].length; i++)
    document.setta["R"+indice][i].checked = false
    }

    function notext(indice) {
    document.setta["T"+indice].value = ''
    }


    </script>

    Non ho controllato il codice...

    FUNZIONE....

    <body onload="addpop('fin2','pagina.html',null,250,250,4 40,300,'right','bottom','left','top')">

  5. #5
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    scusa ma questo codice dove lo inserisco?
    sara

  6. #6
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    mi puoi spiegare meglio?
    grazie
    sara

  7. #7
    Utente bannato
    Registrato dal
    Jan 2002
    Messaggi
    852
    Non ho fatto niente di eccezionale, sono andato nel sito ho copiato il codice sorgente e la funzione...

    copia il codice tra l'head ho ancora meglio in un include...

    poi usa la funzione per richiamare la popup

  8. #8
    Utente di HTML.it
    Registrato dal
    Jun 2004
    Messaggi
    295
    non mi funziona: ho messo il codice: <body onload="addpop('fin2','pagina. html',null,250,250,440,300,'right','bott
    om','left','top')">
    nel body
    e con tutto il codice di sopra ci ho fatto una pagina.html da un file.txt

    dove sbaglio?
    sara

  9. #9
    Utente bannato
    Registrato dal
    Jan 2002
    Messaggi
    852
    Salva questo in un file html

    <html>

    <head>

    <title>standard popup v.1</title>



    <script type="text/javascript" src="standardpop.js"></script>
    <script type="text/javascript">
    ////////////////////////////////////////////////////////////
    /// funzioni per l'interfaccia

    function valore(radio,text) {
    var val
    var rad = false
    for(i=0; i< document.setta["R"+radio].length; i++)
    if(document.setta["R"+radio][i].checked)
    {val = document.setta["R"+radio][i].value;
    rad = true;}
    if(!rad) val = eval(document.setta["T"+text].value) || null;
    return(val)
    }


    function setarea(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,i ntopf,fileftf,fitopf,passowf,passohf,msf,aff) {
    if(tools!=null) tools = "'"+tools+"'"
    if(typeof(iwf)=="string") iwf="'max'"
    if(typeof(ihf)=="string") ihf="'max'"
    if(typeof(fwf)=="string") fwf="'max'"
    if(typeof(fhf)=="string") fhf="'max'"
    if(typeof(inleftf)=="string") inleftf="'"+inleftf+"'"
    if(typeof(intopf)=="string") intopf="'"+intopf+"'"
    if(typeof(fileftf)=="string") fileftf="'"+fileftf+"'"
    if(typeof(fitopf)=="string") fitopf="'"+fitopf+"'"

    document.setta.S1.value = ""
    newaction = null
    if(aff) {
    document.setta.S1.value = "newaction = \""+aff+"\"\n"
    newaction = "newaction"
    }

    document.setta.S1.value += "addpop('"+nomef+"','"+urlf+"',"+tools+","+iwf+"," +ihf+","+fwf+","+fhf+","+inleftf+","+intopf+","+fi leftf+","+fitopf+","+passowf+","+passohf+","+msf+" ,"+newaction+",null)"
    }



    function verifica() {
    var errore=false;
    if (document.setta.T1.value =='') errore=true; else nomef = document.setta.T1.value;

    urlf = document.setta.T2.value || '' ;
    tools = document.setta.T2b.value || null;

    if (document.setta.T3.value =='') errore=true;
    else iwf = (document.setta.T3.value=='max') ? iwf = 'max' : eval(document.setta.T3.value);
    if (document.setta.T4.value =='') errore=true;
    else ihf = (document.setta.T4.value=='max') ? ihf = 'max' : eval(document.setta.T4.value);

    inleftf = valore(1,5); if(inleftf == null) errore=true;
    intopf = valore(2,6); if(intopf == null) errore=true;

    fwf = (document.setta.T7.value=='max') ? fwf = 'max' : (eval(document.setta.T7.value) || null);
    fhf = (document.setta.T8.value=='max') ? fhf = 'max' : (eval(document.setta.T8.value) || null);

    fileftf = valore(3,9);
    fitopf = valore(4,10);

    passowf = eval(document.setta.T11.value) || null;
    passohf = eval(document.setta.T12.value) || null;

    msf = eval(document.setta.T13.value) || null;
    aff = document.setta.T14.value || null;
    if(!errore) {
    setarea(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,i ntopf,fileftf,fitopf,passowf,passohf,msf,aff)
    addpop(nomef,urlf,tools,iwf,ihf,fwf,fhf,inleftf,in topf,fileftf,fitopf,passowf,passohf,msf,aff);
    }
    else alert("ERRORE NELLA COMPILAZIONE DEL FORM")
    }

    function nocheck(indice) {
    for(i=0; i<document.setta["R"+indice].length; i++)
    document.setta["R"+indice][i].checked = false
    }

    function notext(indice) {
    document.setta["T"+indice].value = ''
    }



    </script>

    </head>
    <body>

    <input type="button" name="aprifin2" value="CIAO!!!!" onclick="addpop('fin2','pagina.html',null,250,250, 440,300,'right','bottom','left','top')">

    </body>
    </html>


    salva questo nel file standardpop.js

    /////////////////////////////////////////////
    /// ///
    /// creato da standard © 2002 ///
    /// ///
    /// con la collaborazione di kronik ///
    /// ///
    /////////////////////////////////////////////


    function initleft(valleft,valwidth) {
    if(typeof(valleft)== "string") {
    switch(valleft) {
    case "left": retleft = 0; break;
    case "center": retleft = (screen.width - valwidth)/2; break;
    case "right": retleft = screen.width - valwidth; break;
    default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
    }
    }
    else retleft = valleft
    return(retleft)
    }


    function inittop(valtop,valheight) {
    if(typeof(valtop)== "string") {
    switch(valtop) {
    case "top": rettop = 0; break;
    case "center": rettop = (screen.height - valheight)/2; break;
    case "bottom": rettop = screen.height - valheight; break;
    default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
    }
    }
    else rettop = valtop
    return(rettop)
    }


    function initpassitot() {
    this.passitot = Math.round(Math.max(Math.abs((this.fw-this.iw))/Math.abs(this.passow),Math.abs((this.fh-this.ih))/Math.abs(this.passoh)))

    if(!this.passitot || this.passitot==0)
    this.passitot = Math.round(Math.max(Math.abs((this.fl-this.il))/Math.abs(this.passow),Math.abs((this.ft-this.it))/Math.abs(this.passoh)))
    }


    function popplay() {

    if(!this.pp.closed){

    this.pp.focus()

    if(this.ciclo < this.passitot) {
    opw = (this.passow > 0) ? "<" : ">" ;
    oph = (this.passoh > 0) ? "<" : ">" ;

    if(eval("this.iw "+opw+" this.fw")) this.iw += this.passow
    if(eval("this.ih "+oph+" this.fh")) this.ih += this.passoh

    this.il += this.passol
    this.it += this.passot
    this.pp.resizeTo(this.iw,this.ih)
    this.pp.moveTo(this.il,this.it)
    this.ciclo++
    eval("setTimeout(this.obj+'.play()',"+this.ms+")")
    }
    else {
    this.ciclo = 0
    eval(this.af)
    }
    }
    }


    function popslide(fw,fh,fileft,fitop,passow,passoh,ms,af,no slide){

    this.fw = (fw == "max") ? screen.width : (fw || this.iw);
    this.fh = (fh == "max") ? screen.height : (fh || this.ih);
    this.fl = (fileft) ? initleft(fileft,this.fw) : initleft(this.inleft,this.fw);
    this.ft = (fitop) ? inittop(fitop,this.fh) : inittop(this.intop,this.fh);
    this.inleft = fileft || this.inleft;
    this.intop = fitop || this.intop;
    this.passow = (this.fw - this.iw >=0) ? (passow || 10) : eval("-"+(passow || 10));
    this.passoh = (this.fh - this.ih >=0) ? (passoh || 10) : eval("-"+(passoh || 10));
    this.passi()
    this.passol = (this.fl - this.il)/this.passitot
    this.passot = (this.ft - this.it)/this.passitot
    this.ms = ms || 10;
    this.af = af || ''
    if(!noslide) this.play()
    }


    function pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft ,fitop,passow,passoh,ms,af,noslide) {
    this.obj = nome
    this.iw = (iw == "max") ? screen.width : iw;
    this.ih = (ih == "max") ? screen.height : ih;

    this.il = initleft(inleft,this.iw)
    this.it = inittop(intop,this.ih)

    tools = tools || '';
    if(document.layers)
    tools = (tools.toLowerCase().indexOf("resizable")==-1) ? 'resizable=yes,'+tools : tools;

    this.pp = window.open(url,nome,tools+" width=100,height=100,left="+this.il+",top="+this.i t)
    this.pp.resizeTo(this.iw,this.ih)
    this.ciclo = 0

    this.inleft = inleft
    this.intop = intop
    this.slide(fw,fh,fileft,fitop,passow,passoh,ms,af, noslide)

    }



    function popclose() {
    this.pp.close()
    }


    function poplocation(url) {
    this.pp.location = url
    this.pp.focus()
    }


    function addpop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fil eft,fitop,passow,passoh,ms,af,noslide) {
    eval(nome+" = new pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft ,fitop,passow,passoh,ms,af,noslide);")
    }


    pop.prototype.passi = initpassitot
    pop.prototype.slide = popslide
    pop.prototype.play = popplay
    pop.prototype.close = popclose
    pop.prototype.location = poplocation





    CIAO

  10. #10
    Utente di HTML.it L'avatar di pariri
    Registrato dal
    Jul 2003
    Messaggi
    1,470
    Ciao Sara80,
    prova a guardare questa pillola:

    Pillola PopUp


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.