0% found this document useful (0 votes)
3 views6 pages

Interactive Forms for Toy Orders and Menus

The document contains HTML and JavaScript code for four different exercises. Each exercise includes forms for user input, such as selecting toys, hotel categories, menu items, and intervention details, along with corresponding JavaScript functions to handle user interactions and calculations. The code demonstrates various functionalities like updating fields based on selections, validating inputs, and calculating totals.

Uploaded by

mohamed.sekrafi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Interactive Forms for Toy Orders and Menus

The document contains HTML and JavaScript code for four different exercises. Each exercise includes forms for user input, such as selecting toys, hotel categories, menu items, and intervention details, along with corresponding JavaScript functions to handle user interactions and calculations. The code demonstrates various functionalities like updating fields based on selections, validating inputs, and calculating totals.

Uploaded by

mohamed.sekrafi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Exercice1.

html
<html>
<script src="[Link]"></script>
<body onload="affTemps()">
<form name="f">
Commande livréelemois:<input type="text"name="mois"/> de l'année <input
type="text"name="annee"/><br></br>

Nom et Prénom <input type="text"name="nom"/><br></br>

Choix du ou des jouets: <input type="checkbox" name="velo" value="100" onclick="affMt()"> Vélo


<input type="checkbox" name="rollers" value="50" onclick="affMt()"> Rollers
<input type="checkbox" name="ballon" value="10" onclick="affMt()"> Ballon Foot <br></br>

Montant <input type="text"name="montant"/><br></br>

Payement par: <select name="pay" onchange="affCarte()">


<option value="0">E-dinar</option>
<option value="1">Visa</option>
</select>

code carte <input type="text"name="code" disabled/>


<input type="submit" value="valider" >

</form>
</body>
</html>

[Link]
function affTemps()
{
var d=new Date();
[Link]=[Link]()+1;
[Link]=[Link]();
}

function affMt()
{
var s=0;
if([Link]==true) s+=parseInt([Link]);
if([Link]==true) s+=parseInt([Link]);
if([Link]==true) s+=parseInt([Link]);
[Link]=s;

function affCarte()
{

1
if([Link]==0) [Link]=true;
else [Link]=false;
}

[Link]
<html>
<script src="[Link]"></script>
<body onload="affTemps()">
<form name="f">
Catégorie: <input type="radio" name="cat" value="3" onclick="AfficheEtoile();VerifChaine()" />3
<input type="radio" name="cat" value="4" checked onclick="AfficheEtoile()"
/>4
<input type="radio" name="cat" value="5" onclick="AfficheEtoile()"
/>5<br></br>

Nom holel:<input type="text"name="hotel" onchange="VerifNom()"/> <input


type="text"name="etoile" value="****" disabled /><br></br>

Chaine <select name="chaine" onclick="VerifChaine()">


<option value="AlMouradi">AlMouradi</option>
<option value="AbouNawas">Abou Nawas</option>
</select> </br>
Tel <input type="text" name="tel" onchange="VerifTel()"/><br>
Site Web <input type="text" name="site" onchange="VerifSite()"/><br>
</form>
</body>
</html>

[Link]
function AfficheEtoile()
{
var s="";
var e=parseInt([Link]);
for(i=0;i<e;i++) s+="*";
[Link]=s;
}

function VerifNom()
{
var s=[Link];
[Link]=[Link]();
if([Link]=="") alert("erreur nom hotel");
}

function VerifChaine()
{
2
var ind=[Link];
if(([Link]==3)&&([Link][ind].value=="AbouNawas")) alert("erreur");
}

function VerifTel()
{
if(isNaN([Link])) alert("tel non valide");
}

function VerifSite()
{
var s=[Link];
s1=[Link](0,4);
s1=[Link]();
if(s1!="www.") alert("site non valide");
}

[Link]
<html>
<script src="[Link]"></script>
<body onload="afficherTemps()">
<input type="text" id="Temps" disabled /><br></br>
<center><h1>Composez votre menu</h1></center>
Choisissez un menu en quantités voulues, puis appuyez sur le bouton "Calculer total".<br></br>
<form name="f">
Menu <select name="Menu" >
<option value="0">Aucun</option>
<option value="6500">Salade</option>
<option value="14500">Couscous</option>
<option value="3500">Dessert</option>
</select>

Quantités <input type="text" name="Qte" value="0"/><br></br>


<input type="button" name="calcul" value="Calculer total" onclick="Calculer()"/>
Total <input type="text" name="Total" value="0" id="T" readonly /><br></br>

<input type="checkbox" name="domicile" onclick="activerAdresse()"> commande à


domicile<br></br>

Adresse <textarea name="adresse" cols = "20" rows="2" > </textarea> <br></br>

</form>
</body>
</html>

3
[Link]
function afficherTemps()
{
setInterval("Horloge()", 1000);
}
function Horloge()
{
var dt=new Date();
var a=[Link]("Temps");
[Link]=[Link] ()+":"+[Link]()+":"+[Link]();
}

function Calculer()
{
var ind=[Link];
var t=[Link][ind].value*[Link];
[Link]=t;
}

function activerAdresse()
{
if([Link]==false)
{
[Link]="";
[Link]=true;
}
}

[Link]
<html>
<script src="[Link]"></script>
<body onload="affDate()">
Intervention: Fiche Technique<br><br>
<form name="f">
Intervenant:
<select name="intervenant" onclick="DesacInt()">
<option value="externe">Intervenant Externe</option>
<option value="Salhi">Salhi Mohamed</option>
<option value="Tijani">Tijani Hédi</option>
<option value="Ameur">Ameur Alia</option>
</select>
Nom Intervenat Externe: <input type="text" name="inter_ext"><br><br>

Mois de l'intervention: <input type="text" name="mois">


Année de l'intervention: <input type="text" name="annee"><br><br>
Description de l'intervention:<textarea rows="3" cols="40" name="description"
onblur="AffCode()"></textarea><br><br>

4
Code intervention: <input type="text" name="code"><br><br>

Urgence: <input type="radio" name="urgence" value="100" checked onclick="CalCout()">situation


critique
<input type="radio" name="urgence" value="50"
onclick="CalCout()">situation semi-urgente
<input type="radio" name="urgence" value="10"
onclick="CalCout()">situation ordinaire<br><br>

Cout <input type="text" name="cout" value="100"><br><br>


<input type="button" value="Valider">

</form>
</body>
</html>

[Link]
function DesacInt()
{
if([Link]==0) f.inter_ext.disabled=false;
else f.inter_ext.disabled=true;
}

function affDate()
{
var date_jour = new Date();
var mois = date_jour.getMonth();
var tab= new
Array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Nove
mbre","Decembre");
[Link]=tab[mois];
[Link]=date_jour.getFullYear();
}

function AffCode()
{
var d=[Link];
s=[Link]();
if([Link]("danger")==-1)
[Link]="Int RAS";
else
{
tab=[Link](" ");
[Link]="X"+tab[0];
}
}

function CalCout()
{
[Link]=[Link];

5
}

You might also like