jaxomknight Posted August 24, 2005 Share Posted August 24, 2005 Dans une page, je dois donner le focus à un input uniquement si cet input existe. Comment tester son existence ? Link to comment Share on other sites More sharing options...
fabien29200 Posted August 24, 2005 Share Posted August 24, 2005 Tu veux dire si il y a qqchose d'écrit dans l'input ? Link to comment Share on other sites More sharing options...
ImoTheP Posted August 25, 2005 Share Posted August 25, 2005 Un truc dans le genre devrait fonctionner : <script type="text/javascript"> if(document.form.champs.value != "NULL") { document.form.champs.focus(); } </script> Edit : ça marche... Link to comment Share on other sites More sharing options...
link182 Posted August 25, 2005 Share Posted August 25, 2005 tu peux juster tester l'existence de l'objet : if (document.form.champs) { // si champs existe... } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.