PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > macromedia.dyna.html > DOM scriptiing
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
DOM scriptiing

Réponse
 
LinkBack Outils de la discussion
Vieux 24/04/2008, 14h30   #1
Mattastic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut DOM scriptiing

Hi Guys,

I'm trying to validate my form and loop thorugh each checkbox to see if it has
been checked. My html is below, Im trying to get the length of the checkbox
array by using:

alert(document.form.transport.length);

However, it keeps saying it has no properties, can anyone please ?

Thankyou



<ffform name="form" action="#" method="post" onSubmit="return
CheckFieldBlank()">
<input id="Bycycle" type="checkbox" name="transport" value="Bycycle" />
<input id="Motorscooter" type="checkbox" name="transport"
value="Motorscooter" />
<input id="Motorbike" type="checkbox" name="transport"
value="Motorbike" />
<input id="Car" type="checkbox" name="transport" value="Car" />
</form>

  Réponse avec citation
Vieux 24/04/2008, 14h48   #2
Murray *ACE*
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: DOM scriptiing

Is this a typo?

<ffform name="form"

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Mattastic" <webforumsuser@macromedia.com> wrote in message
news:fuq21c$7jn$1@forums.macromedia.com...
> Hi Guys,
>
> I'm trying to validate my form and loop thorugh each checkbox to see if it
> has
> been checked. My html is below, Im trying to get the length of the
> checkbox
> array by using:
>
> alert(document.form.transport.length);
>
> However, it keeps saying it has no properties, can anyone please ?
>
> Thankyou
>
>
>
> <ffform name="form" action="#" method="post" onSubmit="return
> CheckFieldBlank()">
> <input id="Bycycle" type="checkbox" name="transport"
> value="Bycycle" />
> <input id="Motorscooter" type="checkbox" name="transport"
> value="Motorscooter" />
> <input id="Motorbike" type="checkbox" name="transport"
> value="Motorbike" />
> <input id="Car" type="checkbox" name="transport" value="Car" />
> </form>
>


  Réponse avec citation
Vieux 24/04/2008, 15h22   #3
Mattastic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: DOM scriptiing

Not in my code, I quickly typed up this post.

Thanks
  Réponse avec citation
Vieux 24/04/2008, 18h36   #4
Mick White
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: DOM scriptiing

Mattastic wrote:
> Hi Guys,


>
> alert(document.form.transport.length);
>
> However, it keeps saying it has no properties, can anyone please ?
>
> Thankyou
>
>
>
> <ffform name="form" action="#" method="post" onSubmit="return
> CheckFieldBlank()">


>

"form" is a reserved word in js, I recommend you not use it.
<body>
<script>
function CheckFieldBlank(form){
var a=form.transport.length,b=[];
alert(a);
while(a--){
if(form.transport[a].checked)b.push(form.transport[a].value)
}
if(b.length) {
alert("These checked:\n"+b.join("\n"));return true;
}
alert("none checked");return false;
}
</script>
<form name="f" action="#" method="post"
onsubmit="return CheckFieldBlank(this)">
<input id="Bycycle" type="checkbox" name="transport"
value="Bycycle">
<input id="Motorscooter" type="checkbox" name="transport"
value="Motorscooter">
<input id="Motorbike" type="checkbox" name="transport" value="Motorbike">
<input id="Car" type="checkbox" name="transport"
value="Car">
<input name="smit" type="submit" value="go">
</form>
</body>

Mick
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h53.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09892 seconds with 12 queries