SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    not working under netscape

    Iv' got the following script working perfectly under internet explorer or mozilla but does not work under netscape!!

    Code:
    <script language="JavaScript">
    generationListe = new Array();
    generationListe["Exterieur"] = new Array("High Graphics","Low Graphics");
    generationListe["Interieur"] = new Array("Windows", "Linux");
    var choixTypeFct;
    function generationEnvFct(leForm)
    {
    	  var champsDest = leForm.envFct;
    	  var valSel = leForm.typeFct.value;
    	  var taille = champsDest.options.length;	 
    	  for(var i=1; i < taille ; i++)
    	  {
    			champsDest.options[1] = null;
    	  }	 
    	  for(var i=0; i < generationListe[valSel].length; i++)
    	  {
    			var opt = new Option(generationListe[valSel][i]);
    			champsDest.options[champsDest.options.length] = opt;
    	  }
    	  champsDest.focus();
    }
    </script>
    </head>
    
    <br /><select name="typeFct" onchange="choixTypeFct=this.selectedIndex; generationEnvFct(this.form)" style="background-color:#99CCFF;">
    	  <option>Sélectionnez un type fonctionnel</option>
    	  <option value="Exterieur">Extérieur</option>
    	  <option value="Interieur">Intérieur</option>
    </select>
    <select name="envFct" style="background-color:#99CCCC;">
    <option>Sélectionnez un environnement</option>
    </select>
    Can someone bring me a solution please?

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its working for me in everything except NN4.7 - is that what youre trying to get it working in?

  3. #3
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I did some tests in NN 4.7 and I think you've really shot right over its abilities. Your probably going to have to build a seperate function and sniff for it (such a pain)... anyway here's what I did I added an alert to see these variables here:

    var champsDest = leForm.envFct;
    var valSel = leForm.typeFct.value;
    var taille = champsDest.options.length;

    alert(champsDest + " " +valSel+" "+taille);

    and heres the alert I got:




    I think right here you can start to see the problems but I did also get a javascript error by using the NN4 javascript console. Here's the error from it:

    JavaScript Error: file:/C|/Documents and
    Settings/Administrator/My Documents/point
    code/frenchform.html, line 20:

    generationListe[valSel] has no properties.

    Im also having a minor problem with the language, sorry I failed french in school


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •