Pb de lancement onclick="fonction();"&gt

Résolu/Fermé
cgershon Messages postés 267 Date d'inscription lundi 21 avril 2008 Statut Membre Dernière intervention 25 janvier 2016 - 2 janv. 2009 à 11:07
cgershon Messages postés 267 Date d'inscription lundi 21 avril 2008 Statut Membre Dernière intervention 25 janvier 2016 - 4 janv. 2009 à 08:39
Bonjour,

Je n'arrive pas a lancer la fonction nouvelle() lors du click sur le input 'nouveau' parmis les 3 input qui sont dans la form pourquoi ?

<script type="text/javascript" language="javascript" >

function clr(champ){
document.getElementById(champ).value= "";

}
function nouvelle(){
clr("style");
clr("origine");
clr("Particularites");
clr("groupes");
clr("site");
}


</script>
<span style="position:absolute;left:350px;top:15px; " >
<h1>Introduire un nouvel artiste</h1></span>
<span style="position:absolute;left:800px;top:25px; " > base: hadad  table:artistes
<?php echo '<font color="">'.' '.date("d").' '.date("m").' '.date("Y");?>
</span>


<fieldset>
<span style="position:absolute;left:270px;top:55px; " >

<form method="post" name = "inscription" onsubmit=" signin(this.nomd.value,this.prenomd.value,this.style.value,this.origine.value,this.groupes.value,this.particularites.value,this.site.value,this.code.value,'artistes');return false;" >
<div id="msg">
</div>
<table width="800" border="2" cellspacing="3" align="left">
<tr>
<td >
<div style="position:relative;left:10px;top:0px; ">
<label class="alignleft" for="nomd"> <strong>Nom de l'artiste:</strong>
</label> 
<input name="nomd" id="nomd" size="30" maxlength="30" >
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; " >
<label class="alignleft" for="prenomd"> <strong>Prenom:</strong>
</label> 
<input name="prenomd" id="prenomd" size="30" maxlength="30" >
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; " >
<label class="alignLeft" for="style"> <strong>Style:</strong>
</label> 
<input name="style" id="style" size="30" maxlength="30">
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; ">
<label class="alignLeft" for="origine"> <strong>Origine:</strong>
</label> 
<input name="origine" id="origine" size="30" maxlength="30" >
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; ">
<label class="alignLeft" for="particularites"> <strong> Particularités:</strong>
</label> 
<textarea name="particularites" rows="8" cols="70">
Votre message ici.
</textarea>
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; ">
<label class="alignLeft" for="groupes"> <strong>groupes:</strong>
</label> 
<textarea name="groupes" id="groupes" rows="8" cols="70">
Votre message ici.
</textarea>
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; " >
<label class="alignLeft" for="site"> <strong>Site Web:</strong>
</label>
<input name="site" id="site" size="50" maxlength="50" >
</div></td>
</tr>
<tr>
<td >
<div style="position:relative;left:10px;top:0px; " >
<label class="alignLeft" for="code"> <strong>Code(o=lettre 0=chiffre):</strong>
</label>   
<img src="image_code.php" alt="" >
<input name="code" id="code" size="5" maxlength="4">
</div></td>
</tr>
<tr>
<td colspan="2">
<div class="alignRight">
<input name="envoyer" type="submit" value="Envoyer" >
</div></td>
<td colspan="2">
<div class="alignRight">
<input name="nouvelle" type="submit" value="Nouveau" onclick="nouvelle();">
</div></td>
<td colspan="2">

<div class="alignRight">
<input name="annuler" type="submit" value="Annuler" onclick="javascript:history.back();">
</div></td>


</tr>
</table>
</form>
</fieldset>
A voir également:

2 réponses

Benjamincom Messages postés 232 Date d'inscription vendredi 21 décembre 2007 Statut Membre Dernière intervention 19 septembre 2021 61
2 janv. 2009 à 17:08
Remplace:
<input name="nouvelle" type="submit" value="Nouveau" onclick="nouvelle();">

par
<button type="button" name="nouvelle" value="Nouveau" onclick="nouvelle();"></button>
0
ThEBiShOp Messages postés 8378 Date d'inscription jeudi 22 mars 2007 Statut Contributeur Dernière intervention 8 février 2021 1 565
2 janv. 2009 à 18:16
pourquoi s'encombrer d'une fonction javascript (qui ne marchera donc pas sur tous les navigateurs) quand la fonction a été prévue en html ?

<input type="reset" value="On efface et on recommence..." />
0
cgershon Messages postés 267 Date d'inscription lundi 21 avril 2008 Statut Membre Dernière intervention 25 janvier 2016 4
4 janv. 2009 à 08:39
Merci pour le tip c'est plus facile et portable !
0