Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with netscape

Status
Not open for further replies.

cgirard

Programmer
Sep 3, 2002
4
0
0
CA
Hi everybody , i have a problem with netsacpe . When i execute this code withe internet explorer 5.5 it's work fine
but when i try to exute it with netscape 4.75 it's fail. What is the problem?

Here is the code :

<SELECT NAME=&quot;zlProduit&quot; ONCHANGE=&quot;document.location='shopping/product_details.php?id='+ document.frmDemo1.zlProduit.value&quot;> <?
echo &quot;<OPTION VALUE='0'>----------------- Sélectionnez un produit ----------------</OPTION>&quot;;

Thanks in advance
Chris!!
 
Instead of this:
[tt]document.frmDemo1.zlProduit.value[/tt]

you have to write this:
[tt]document.frmDemo1.zlProduit.options[document.frmDemo1.zlProduit.selectedIndex].value[/tt]

You can make it shorter in your case:
[tt]this.options[this.selectedIndex].value[/tt]

This will work in all browsers.
Remember, selectedIndex should be written exactly the same way as I did here.
 
This message is for starway. I try the code that you give me
instead of the one that i had in my page and it's don't work
either. Any other idea ?

Thank you for your help!

Chris
 
&quot;smth don't work&quot; - this doesn't tell us anything.
I gave you the right syntax for accessing selected element of a drop-down box. It is used in hundreds of scripts and works as it should, so the problem can be somewhere else.

Why don't you show the code? The code should be complete so it's possible to investigate the problem.
 
Here is the code
When i choose a product from the drop-down
box nothing happen .

SELECT NAME=&quot;zlProduit&quot; ONCHANGE=&quot;document.location='shopping/product_details.php?id='+ document.frmDemo1.zlProduit.options[document.frmDemo1.zlProduit.selectedIndex].value;&quot;>
<?
//document.frmDemo1.zlProduit.value
//document.location='shopping/product_details.php
echo &quot;<OPTION VALUE='0'>----------------- Sélectionnez un produit ----------------</OPTION>&quot;;
while ($enr = mysql_fetch_array($resultat)) {
echo &quot;<OPTION VALUE='&quot;.$enr[2].&quot;'&quot;;
//$id=0;
//if ($id == $enr[0]) echo &quot; SELECTED&quot;;
echo &quot;>&quot;.htmlspecialchars($enr[1]).&quot;</OPTION>\n&quot;;

}
echo &quot;</SELECT>&nbsp;\n&quot;;
 
I can't test PHP code, sorry. I don't see any error in my part though.
Anyway, I'd change it to shorter record using &quot;this&quot; - it will make your code look more clean.
 
try changing document.location to document.location.href
 
Qu'est-ce que c'est la nomme de la forme? What's your form name? You're only showing bits and pieces of your code, so it's impossible to accurately assess the problem. Show the entire form. I don't see any closing on the PHP code, either, though you chopped off in your second example some of what you showed in your first.
 
Je sais que mon francais n'est pas tres bon, mais c'etait longtemps que j'avais parle en francais. :)#(sourire avec barbe)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top