Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Marche pas avec fireFox.

4 réponses
Avatar
RedPower
Quelqu'un peut-il m'expliquer pourquoi ce code ne marche pas avec
fireFox 0.8 ?
Alors qu'avec IE, il marche...
Merci.

<html>
<head>
</head>

<body>
<SCRIPT type="text/javascript">
function afficherPrix(index)
{
form1.text1.value = form1.select1.options[index].value;
form1.textarea1.value = form1.select1.options[index].value;
}

</SCRIPT>

<form name="form1">
<select name="select1" onChange="afficherPrix(selectedIndex);">
<option value=33.45>toto1
<option value=45.14>toto2
<option value=65.78>toto3
<option value=65.14>toto4
<option value=67.14>toto5
</select>

<input type="text" name="text1" value="">
<textarea name="textarea1">
</textarea>

</form>

</body>
</html>

4 réponses

Avatar
Michael DENIS
Le 14 Apr 2004 07:28:29 +0200, RedPower écrivait:

Quelqu'un peut-il m'expliquer pourquoi ce code ne marche pas avec
fireFox 0.8 ?
Alors qu'avec IE, il marche...



IE est trop permissif. Le problème, c'est que le html présenté est
assez loin d'être valide. Comme ceci, on s'en rapproche déjà un peu
plus (à supposer que vous souhaitiez faire du 4.01 transitional):

**********************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-15">
<META NAME="language" CONTENT="fr">
<TITLE>Test</TITLE>
</head>

<body>
<SCRIPT type="text/javascript">
function afficherPrix(index)
{
form1.text1.value = form1.select1.options[index].value;
form1.textarea1.value = form1.select1.options[index].value;
}

</SCRIPT>

<form name="form1">
<select name="select1" onChange="afficherPrix(selectedIndex);">
<option value3.45>toto1
<option valueE.14>toto2
<option valuee.78>toto3
<option valuee.14>toto4
<option valueg.14>toto5
</select>

<input type="text" name="text1" value="">
<textarea name="textarea1">
</textarea>

</form>

</body>
</html>
**********************************

Dans tous les cas, la valideur html du W3C est votre ami: :-)
<http://validator.w3.org/&gt;

--
Michaël DENIS


Déco? <http://www.toiles-de-mayenne.com/&gt;
Avatar
RedPower
Le 04/14/2004 07:52 AM :
Le 14 Apr 2004 07:28:29 +0200, RedPower écrivait:


Quelqu'un peut-il m'expliquer pourquoi ce code ne marche pas avec
fireFox 0.8 ?
Alors qu'avec IE, il marche...




IE est trop permissif. Le problème, c'est que le html présenté est
assez loin d'être valide. Comme ceci, on s'en rapproche déjà un peu
plus (à supposer que vous souhaitiez faire du 4.01 transitional):

**********************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-15">
<META NAME="language" CONTENT="fr">
<TITLE>Test</TITLE>
</head>

<body>
<SCRIPT type="text/javascript">
function afficherPrix(index)
{
form1.text1.value = form1.select1.options[index].value;
form1.textarea1.value = form1.select1.options[index].value;
}

</SCRIPT>

<form name="form1">
<select name="select1" onChange="afficherPrix(selectedIndex);">
<option value3.45>toto1
<option valueE.14>toto2
<option valuee.78>toto3
<option valuee.14>toto4
<option valueg.14>toto5
</select>

<input type="text" name="text1" value="">
<textarea name="textarea1">
</textarea>

</form>

</body>
</html>
**********************************


Cela ne marche toujours pas...Ni avec la suite Mozilla et Galeon.

Dans tous les cas, la valideur html du W3C est votre ami: :-)
<http://validator.w3.org/&gt;


Merci du conseil.
Avatar
Thibaut Allender
on 14/04/2004 7:28, RedPower wrote :

Quelqu'un peut-il m'expliquer pourquoi ce code ne marche pas avec
fireFox 0.8 ?
Alors qu'avec IE, il marche...



quelle reference ;)

au lieu de dire "alors qu'avec IE il marche" tu ferais mieux de taper
"javascript:" comme url, afin d'avoir la console javascript sous les
yeux, qui te dit "form1 is not defined"

ce qui est normal, car d'apres ton code, il devrait etre le parent de qq
chose...
ici le parent, c'est "document"

remplace ton code javascript par ceci et ca fonctionnera :

document.form1.text1.value = document.form1.select1.options[index].value;
document.form1.textarea1.value =
document.form1.select1.options[index].value;


--
thibaut allender | freelance | web|system developer|designer
+32 496 26 75 76 | http://capsule.org
Avatar
RedPower
> ce qui est normal, car d'apres ton code, il devrait etre le parent de qq
chose...
ici le parent, c'est "document"

remplace ton code javascript par ceci et ca fonctionnera :

document.form1.text1.value = document.form1.select1.options[index].value;
document.form1.textarea1.value = document.form1.select1.options[index].value;




Merci beaucoup de ton aide. Effectivement, cela marche.