Bonjour,
voila j'explique mon problème
j'ai ai total 6 checkbox plus 3 retour sur div(affiche un texte ) si on click sur tel ou tel check box
la structure est simple
j'ai 3 chekbox principal produit 1, produit 2, produit 3
2 check box secondaire option 1 option 2
mon principe qui fonctionne est le suivant si on click su le produit 1 on peut cocher l'option 1 & 2
pareil pour 2
mais pour le 3 les option 1 & 2 sont alors cocher et désactiver
mon problème réside ensuite est que je veut afficher un prix dans un autre div
si on coche le produit 1 & option 2 je doit afficher un prix dans un div
je bloque sur le prix le reste fonctionne bien .. si qq a une solution ?
ce qui marche pas :
Code Javascript :
<script type="text/javascript" language="JavaScript">
function traitement_check()
{
if (achat.checked == true; )
{
ref=document.getElementById("prix_f");
ref.innerHTML='<span style="color:#C5281f; font-size:14px">Inclus</span>';
}else{
ref=document.getElementById("prix_f");
ref.innerHTML='ggggg';
}
}
</script>
voici le code de base ( ce qui marche excepter le div -> prix_f
Code Javascript :
<script type="text/javascript" language="JavaScript">
function Chkbox(id){
switch(id){
case "starter" :
document.getElementById("starter").checked = true;
document.getElementById("pro").checked = false;
document.getElementById("premium").checked = false;
document.getElementById("help_desk").disabled=false;
document.getElementById("buy_at_end").disabled=false;
ref=document.getElementById("starter_txt");
ref.innerHTML='€ <span style="color:#C5281f; font-size:14px">10</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois';
ref=document.getElementById("buy_at_end_txt");
ref.innerHTML='€ <span style="color:#C5281f; font-size:14px">4</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois';
break;
case "pro" :
document.getElementById("starter").checked = false;
document.getElementById("pro").checked = true;
document.getElementById("premium").checked = false;
document.getElementById("help_desk").disabled=false;
ref=document.getElementById("starter_txt");
document.getElementById("buy_at_end").disabled=false;
ref.innerHTML='€ <span style="color:#C5281f; font-size:14px">10</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois';
ref=document.getElementById("buy_at_end_txt");
ref.innerHTML='€ <span style="color:#C5281f; font-size:14px">4</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois';
break;
case "premium" :
document.getElementById("starter").checked = false;
document.getElementById("pro").checked = false;
document.getElementById("premium").checked = true;
document.getElementById("help_desk").checked = true;
document.getElementById("help_desk").disabled=true;
document.getElementById("buy_at_end").checked = true;
document.getElementById("buy_at_end").disabled=true;
ref=document.getElementById("starter_txt");
ref.innerHTML='<span style="color:#C5281f; font-size:14px">Inclus</span>';
ref=document.getElementById("buy_at_end_txt");
ref.innerHTML='<span style="color:#C5281f; font-size:14px">Inclus</span>';
break;
}
}
</script>
Code HTML :
<form id="form1" name="form1" method="post" action="add_services.php">
<table width="698" height="301" border="0">
<tr>
<td width="340" height="151" valign="top"><!-- left !-->
<table height="139" border="0" cellpadding="0" cellspacing="0" style="margin-top:12px">
<tr>
<td width="66"> </td>
<td width="266" valign="top"><table width="260" height="134">
<tr>
<td height="14"><b style=" color:#545252; margin-left:30px;">E-commerce</b></td>
</tr>
<tr>
<td height="99" valign="top"><div style="position:absolute; margin-left:153px; width: 118px;"><span style="margin-left:0px;float:right; margin-right:20px; margin-top:-7px">Choix du type</span></div>
<br/>
<div style="margin-left:40px; margin-top:6px;">
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif">
<tr>
<td width="37" align="center"><input name="la" value="E-commerce Starter" type="checkbox" id="starter" onclick="Chkbox(this.id);"></td>
<td width="84" align="center"><img src="images/starter.png" width="78" height="25"></td>
<td width="146" align="right">€ <span style="color:#C5281f; font-size:14px">179</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois</td>
</tr>
</table>
<!-- NEXT !-->
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif; margin-top:5px">
<tr>
<td width="37" align="center"><input type="checkbox" value="E-commerce Pro" name="la" id="pro" onclick="Chkbox(this.id);"></td>
<td width="84" align="center"><img src="images/pro.png" width="78" height="25"></td>
<td width="146" align="right">€ <span style="color:#C5281f; font-size:14px">217</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois</td>
</tr>
</table>
<!-- ON THE NEXT -->
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif; margin-top:5px">
<tr>
<td width="37" align="center"><input type="checkbox" value="E-commerce Premium" name="la" id="premium" onclick="Chkbox(this.id);"></td>
<td width="84" align="center"><img src="images/premium.png" width="78" height="25"></td>
<td width="146" align="right">€ <span style="color:#C5281f; font-size:14px">387</span><span style="color:#545252; font-size:14px">,</span><span style="color:#C5281f; font-size:14px">99</span>/mois</td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<!-- NO MADE !-->
<table height="139" border="0" cellpadding="0" cellspacing="0" style="margin-top:4px">
<tr>
<td width="66"> </td>
<td width="266" valign="top"><table width="260" height="105" style="margin-top:10px">
<tr>
<td height="99" valign="top"><div style="position:absolute; margin-left:150px; width: 118px;"><span style="margin-left:0px;float:right; margin-right:30px; margin-top:-6px">Option(s)</span></div>
<br/>
<div style="margin-left:40px; margin-top:0px;">
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif">
<tr>
<td width="30" align="center"><input type="checkbox" name="achat" value="1" id="buy_at_end" onclick="Chkbox(this.id);traitement_check();"></td>
<td width="92" align="left"><span style="font-size:14px">Achat à terme</span></td>
<td width="79" align="right"><div align="right" id="starter_txt" style="text-align:right"></div></td>
</tr>
</table>
<!-- NEXT !-->
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif">
<tr>
<td width="30" align="center"><input type="checkbox" name="assist" value="1" id="help_desk" onclick="Chkbox(this.id);"></td>
<td width="92" align="left"><span style="font-size:14px; text-align:left">Assistance</span></td>
<td width="79" align="right"><div align="right" id="buy_at_end_txt"></div></td>
</tr>
</table>
<!-- ON THE NEXT --></div>
<div align="right" id="prix_f" style="text-align:right; position:absolute; width:100px; height:30px"></div>
</td>
</tr></table></td>
</tr>
</table></td>
<td width="342" valign="top"><!-- DROITE !-->
<table height="252" border="0" cellpadding="0" cellspacing="0" style="margin-top:39px">
<tr>
<td width="266" valign="top"><table width="260" height="134">
<tr>
<td height="14" align="right"><b style=" color:#545252; margin-right:9px">CONFIRMATION</b></td>
</tr>
<tr>
<td height="99" valign="top"><div style="position:absolute; margin-left:20px; width: 118px;"><span style="float:left; margin-right:20px; margin-top:-8px">Choisissez</span></div>
<br/>
<div style="margin-left:10px; margin-top:15px;">
<table width="201" height="20" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif">
<tr>
<td width="37" align="center"> </td>
<td align="center"><input type="image" name="action" value="ajout" src="images/bt_confirmation_fr.png" width="135" height="20"></td>
</tr>
</table>
<!-- NEXT !-->
<table width="201" height="25" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif; margin-top:0px">
<tr>
<td width="37" align="center"><span style="font-size:14px">ou</span></td>
<td align="center"></td>
</tr>
</table>
<!-- ON THE NEXT -->
<table width="201" height="20" border="0" cellpadding="0" cellspacing="0" style="font-size:10px; font-family:Arial, Helvetica, sans-serif; margin-top:0px">
<tr>
<td width="37" align="center"> </td>
<td align="center"><input type="image" name="action" value="ajout1" src="images/bt_autresachats_fr.png" width="135" height="20"></td>
</tr>
</table>
</div></td></tr></table>
<!-- NEXT RIGHT -----!-->
<div style="margin-top:75px">
<div style="margin-left:30px; margin-top:-5px; text-align:justify"> Confirmez votre choix ou cliquez sur "Autre(s) achat(s) si vous souhaitez ajouter d'autres services.
<div style="float:left; margin-left:-25px; margin-top:-35px"><img src="images/logo_info.png" width="18" height="17" style=" margin-right:2px" /></div>
</div>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>