Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81

    distanza tra partenza ed arrivo

    vorrei porre questo quesito: come faccio a creare una pagina che mi dia la distanza tra un elenco di città di partenza ed un elenco di città in arrivo? l'elenco è composto da una ventina di voci.

    io conosco le distanze tra partenze ed arrivi

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81
    io so già le distanze, si tratta di porti turistici. esiste un javascript pronto che mi consente di chiamare una pagina html con le informazioni relative al punto di partenza ed al punto di arrivo?

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    posta un po' di codice di quello che hai al momento. Dici di avere già la lista delle destinazioni e le distanze, manca solo di creare un form che metta insieme il tutto, giusto?
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  4. #4
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81
    ecco cosa ho trovato (manca solo il modo di creare il collegamento alla pagina):
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Documento senza titolo</title>
    <SCRIPT type=text/javascript>

    var regiondb = new Object()
    regiondb["africa"] = [{value:"102", text:"Cairo"},
    {value:"88", text:"Lagos"},
    {value:"80", text:"Nairobi"},
    {value:"55", text:"Pretoria"}];
    regiondb["asia"] = [{value:"30", text:"Ankara"},
    {value:"21", text:"Bangkok"},
    {value:"49", text:"Pechino"},
    {value:"76", text:"New Delhi"},
    {value:"14", text:"Tokyo"}];
    regiondb["australia"] = [{value:"64", text:"Suva"},
    {value:"12", text:"Sydney"}];
    regiondb["europa"] = [{value:"11", text:"Atene"},
    {value:"35", text:"Francoforte"},
    {value:"3", text:"Londra"},
    {value:"15", text:"Madrid"},
    {value:"1", text:"Parigi"},
    {value:"10", text:"Roma"},
    {value:"6", text:"Stoccolma"},
    {value:"97", text:"San Pietroburgo"}];
    regiondb["noamer"] = [{value:"73", text:"Dallas"},
    {value:"71", text:"Los Angeles"},
    {value:"5", text:"New York"},
    {value:"37", text:"Toronto"}];
    regiondb["suamer"] = [{value:"65", text:"Buenos Aires"},
    {value:"31", text:"Caracas"},
    {value:"66", text:"Rio di Janeiro"}];

    function setCities(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["città"];
    while (cityChooser.options.length) {
    cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "Seleziona una città:";
    newElem.value = ".htm";
    cityChooser.add(newElem, where);
    if (choice != "") {
    for (var i = 0; i < db.length; i++) {
    newElem = document.createElement("option");
    newElem.text = db[i].text;
    newElem.value = db[i].value;
    cityChooser.add(newElem, where);
    }
    }
    }

    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }
    //-->
    </SCRIPT>
    </head>

    <body>


    </p>
    <FORM name=form>Invia la richiesta a: <SELECT onchange=setCities(this)
    name=continente> <OPTION value="" selected>Seleziona il porto di partenza</OPTION>
    <OPTION value=africa>Africa</OPTION> <OPTION value=asia>Asia</OPTION> <OPTION
    value=australia>Australia/Oceania</OPTION> <OPTION
    value=europa>Europa</OPTION> <OPTION value=noamer>Nord America</OPTION>
    <OPTION value=suamer>Sud America</OPTION></SELECT>
    <SELECT name=città onChange="MM_jumpMenu('parent',this,0)">
    <OPTION value="" selected>Seleziona il porto di arrivo</OPTION></SELECT>
    </FORM>
    </body>
    </html>

  5. #5
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81
    la chiamata del file deve essere elaborata dalla funzione setCities(chooser)

  6. #6
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81
    ho trovato lo script nel sito di html

  7. #7
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    81
    problema risolto.
    grazie comunque per l'aiuto.
    inserisco il codice corretto:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Documento senza titolo</title>
    <SCRIPT type=text/javascript>

    var regiondb = new Object()
    regiondb["africa"] = [{value:"102", text:"Cairo"},
    {value:"88", text:"Lagos"},
    {value:"80", text:"Nairobi"},
    {value:"55", text:"Pretoria"}];
    regiondb["asia"] = [{value:"30", text:"Ankara"},
    {value:"21", text:"Bangkok"},
    {value:"49", text:"Pechino"},
    {value:"76", text:"New Delhi"},
    {value:"14", text:"Tokyo"}];
    regiondb["australia"] = [{value:"64", text:"Suva"},
    {value:"12", text:"Sydney"}];
    regiondb["europa"] = [{value:"11", text:"Atene"},
    {value:"35", text:"Francoforte"},
    {value:"3", text:"Londra"},
    {value:"15", text:"Madrid"},
    {value:"1", text:"Parigi"},
    {value:"10", text:"Roma"},
    {value:"6", text:"Stoccolma"},
    {value:"97", text:"San Pietroburgo"}];
    regiondb["noamer"] = [{value:"73", text:"Dallas"},
    {value:"71", text:"Los Angeles"},
    {value:"5", text:"New York"},
    {value:"37", text:"Toronto"}];
    regiondb["suamer"] = [{value:"65", text:"Buenos Aires"},
    {value:"31", text:"Caracas"},
    {value:"66", text:"Rio di Janeiro"}];

    function setCities(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["città"];
    while (cityChooser.options.length) {
    cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "Seleziona una città:";
    newElem.value = ".htm";
    cityChooser.add(newElem, where);
    if (choice != "") {
    for (var i = 0; i < db.length; i++) {
    newElem = document.createElement("option");
    newElem.text = db[i].text;
    newElem.value = db[i].value;
    cityChooser.add(newElem, where);
    }
    }
    }

    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+".htm'");
    if (restore) selObj.selectedIndex=0;
    }
    //-->
    </SCRIPT>
    </head>

    <body>


    </p>
    <FORM name=form>Invia la richiesta a: <SELECT onchange=setCities(this)
    name=continente> <OPTION value="" selected>Seleziona il porto di partenza</OPTION>
    <OPTION value=africa>Africa</OPTION> <OPTION value=asia>Asia</OPTION> <OPTION
    value=australia>Australia/Oceania</OPTION> <OPTION
    value=europa>Europa</OPTION> <OPTION value=noamer>Nord America</OPTION>
    <OPTION value=suamer>Sud America</OPTION></SELECT>
    <SELECT name=città onChange="MM_jumpMenu('parent',this,0)">
    <OPTION value="" selected>Seleziona il porto di arrivo</OPTION></SELECT>
    </FORM>
    </body>
    </html>

  8. #8
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Non sono molto graditi i crossposting... tienilo presente per il tuo prossimo problema
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

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.