Visualizzazione dei risultati da 1 a 7 su 7

Discussione: array e popup

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    186

    array e popup

    Salve ragazzi ; quello sotto e` parte del codice js di un file esterno che nella pagina html appare come un menu` a tendina.
    Volevo chiedere se sia possibile far aprire direttamente dalle voci dell`array var links ("casali.htm", ecc..), per ognuna delle voci, una popup. Si puo`? E se si in che modo? Se non si puo`, come posso aggirare il problema? Grazie.


    var ron="#c6de9e";
    var roff="#ffffff";
    var leftmargin=75;
    var topmargin=272;
    var largo=125;
    var Home = false;
    var HomeLink = "";
    var HomeText = "";
    var HomeWidth = 50;
    var voci=new Array();
    voci[0]=new Array("offerte","casali","immobili di prestigio","monofamiliari","plurifamiliari","altro ");

    var links=new Array();
    links[0]=new Array("#","casali.htm","immobili.htm","monof.htm", "plurif.htm","altro.htm");

    var targets=new Array();
    targets[0]=new Array("self","self","self","self","self","self");

    var wst=new Array();
    wst[0]=new Array("","","","","","");

    var nn=document.layers?true:false,N6=navigator.userAge nt.toLowerCase().indexOf("gecko")!=-1?true:false,conta=0,last=0;
    var op=navigator.userAgent.toLowerCase().indexOf("oper a")!=-1?true:false
    HomeWidth=Home?HomeWidth:0;
    var MenuLength=HomeWidth+largo*voci.length;
    var BrowserWidth=nn||op?window.innerWidth:N6?document. width:document.body.clientWidth;
    //leftmargin=parseInt((BrowserWidth-MenuLength)/2);
    if (nn)
    {
    }
    else{
    if (Home)
    document.write("<DIV ID=mtop. STYLE=\"width:"+HomeWidth+";height:15;background:" +roff+";visibility:visible;cursor:hand\" onMouseOver=showdeps(last,false);mroll('mtop.') onMouseOut=unmroll('mtop.')>"+HomeText+"</DIV>");
    for (i=0;i<voci.length;i++)
    {
    var n=i;
    document.writeln("<DIV ID=mtop"+n+". STYLE=\"width:"+largo+";height:15;background:"+rof f+";visibility:visible;cursor:hand\" onMouseOver=MostraMenu("+n+");mroll('mtop"+n+".'); conta++ onMouseOut=last="+n+";unmroll('mtop"+n+".');conta--><DIV ALIGN=center CLASS=menuIEb onClick=vai('"+links[i][0]+"',"+i+",0)>"+voci[i][0]+"</DIV></DIV>");
    for (l=1;l<voci[i].length;l++)
    document.writeln("<DIV ID=mdep"+i+"."+l+" STYLE=\"width:"+largo+";height:15;background:"+rof f+";visibility:hidden;cursor:hand\" onMouseOver=;mroll('mdep"+n+"."+l+"');conta++ onMouseOut=unmroll('mdep"+n+"."+l+"');conta-- CLASS=menuIE onClick=vai('"+links[i][l]+"',"+i+","+l+")>"+voci[i][l]+"</DIV>");
    }
    }
    timer=setInterval("NascondiMenu()",300)
    function NascondiMenu()
    {
    if (conta==0)
    {
    coloratutti(false)
    timer=setTimeout("coloratutti(false)",200);
    timer=setTimeout("showdeps(last,false)",250);
    }
    }

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    186
    Non si puo` eh..??!

  3. #3
    Utente di HTML.it L'avatar di willybit
    Registrato dal
    May 2001
    Messaggi
    4,367

    Re: array e popup

    Ciao wimkieft,

    bisognerebbe vedere com'è fatta la funzione vai

  4. #4
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    186
    Grazie per avermi risposto. Ora te la mando.

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    186
    Eccola


    function vai(dove,r,c)
    {
    if (c>0)
    lev=nn?document.layers["mdep"+r+"."+c]document.all)?document.all["mdep"+r+"."+c].style:document.getElementById("mdep"+r+"."+c).sty le;
    else
    lev=nn?document.layers["mtop"+r+"."]document.all)?document.all["mtop"+r+"."].style:document.getElementById("mtop"+r+".").style ;
    if (nn)
    {
    }
    else
    {
    lev.background=roff;
    timer=setTimeout("lev.background=ron",50)
    timer=setTimeout("lev.background=roff",100)
    timer=setTimeout("lev.background=ron",150)
    timer=setTimeout("lev.background=roff",200)
    timer=setTimeout("lev.background=ron",250)
    }
    if (navigator.userAgent.toLowerCase().indexOf("msie") !=-1 && navigator.platform.toLowerCase().indexOf("mac")==" mac")
    document.write("")
    timer=targets[r][c]=="self"?setTimeout("self.location.href='"+dove+"' ",350):setTimeout("window.open('"+dove+"')",35 0);
    }

  6. #6
    Utente di HTML.it L'avatar di willybit
    Registrato dal
    May 2001
    Messaggi
    4,367
    Riekkime :gren:

    come immaginavo basterebbe mettere qualcosa di diverso da self nell'array targets per aprire una nuova finestra... però se vuoi aprire una popup con determinate caratteristiche tieni self nell'array targets e nell'array links
    codice:
    links[0]=new Array('#','javascript:window.open("casali.htm","pop","width=300,height=150,resizable=1");void(0);','immobili.htm','monof.htm','plurif.htm','altro.htm');
    praticamente puoi eseguire qualunque istruzione javascript sfruttando la location, basta precedere le istruzioni da un javascript:

    (tanto per provare... anche nella barra degli indirizzi del browser puoi scrivere javascript:alert('ciao');void(0); e ti apparirà l'alert)


  7. #7
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    186
    grazie, funziona!!!

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.