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

    problemi a catturare un parametro

    Sono in preda alla disperazione,
    mi ero trovata un bello scriptino, lo avevo "sapientemente" adattato alle mie esigenze, e poi...
    mi accorgo che la scelta nel secondo select non viene passata come parametro...
    cosa voglio di più dalla vita?
    Un lucano, ma che ci capisca qualcosa di JavaScript e mi dia una mano...

    A seguire il codice, un ringraziamento anticipato a tutti ed in particolare alla terra di Lucania, che ha dato i natali ai più illustri javascriptari.

    AleX


    codice:
    <!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>
    </head>
    
    <body>
    <script language="JavaScript" type="text/javascript">
    
    var num_of_cats = 2; 
    var open_in_newwindow=1; //Set 1 to open links in new window, 0 for no.
    var option_array = new Array(num_of_cats);
    
    option_array[0] = new Array(
    "Attive",
    "Terminate",
    "Annullate");
    
    option_array[1] = new Array(
    "In corso",
    "Acquisite",
    "Non acquisite");
    
    
    function switch_select()
    
    {
      for (loop = window.document.form_1.select_2.options.length-1; loop > 0; loop--)
      {
        window.document.form_1.select_2.options[loop] = null;
      }
      
      for (loop = 0; loop < option_array[window.document.form_1.select_1.selectedIndex].length; loop++)
      {
        window.document.form_1.select_2.options[loop] = new Option(option_array[window.document.form_1.select_1.selectedIndex][loop]);
      }
      
      window.document.form_1.select_2.selectedIndex = 0;
    }
      
    function switch_text()
    
    {
      window.document.form_1.textarea_1.value = text_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex];
    }
    
    function box()
    
    {
      if (window.document.form_1.select_2.selectedIndex == 0)
      {
        alert("Dove vuoi andare?");
      } else {
        if (open_in_newwindow==1)
        window.open(url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex],"_blank");
        else
        window.location=url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex]
      }
    }
    
    function set_orig()
    
    {
      window.document.form_1.select_1.selectedIndex = 0;
      window.document.form_1.select_2.selectedIndex = 0;
    }
    
    window.onload=set_orig
    
    // -->
    </script>
    
    
    <form name="form_1" onsubmit="window.open('Untitled-1.htm?settore='+this.select_1.options[this.select_1.selectedIndex].value+'&tipo='+this.select_2.options[this.select_2.selectedIndex].value);">
    
    <select name="select_1" onchange="switch_select(); switch_text();">
    <option value="MRK">Situazione Iniziative</option>
    <option value="PRO">Situazione Offerte</option>
    </select> <select name="select_2" onchange="switch_text();">
    <option value="Attive">Attive</option>
    <option value="Terminate">Terminate</option>
    <option value="Non presentate">Non presentate</option>
    </select>
    <input type="submit" name="Submit" value="Invia">
    </form>
    
    </body>
    </html>

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Mi sembra la prosecuzione di questa: http://forum.html.it/forum/showthrea...hreadid=741363

    codice:
      for (loop = 0; loop < option_array[window.document.form_1.select_1.selectedIndex].length; loop++)
      {
        window.document.form_1.select_2.options[loop] = new Option(option_array[window.document.form_1.select_1.selectedIndex][loop], option_array[window.document.form_1.select_1.selectedIndex][loop]);
      }
    ciao
    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 © 2025 vBulletin Solutions, Inc. All rights reserved.