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 > hide/reveal xhtml element via a tick box
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
hide/reveal xhtml element via a tick box

Réponse
 
LinkBack Outils de la discussion
Vieux 24/02/2008, 12h23   #1
gwhPoster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut hide/reveal xhtml element via a tick box

Hi everyone,

I've got a form that consists of 3 parts. The first part has all the fields
for the billing address, the second is for the delivery address, and the third
is for the username and password etc. I wanted the second section about the
delivery address to be hidden and for there to be a message saying:

"Please "tick" if your Delivery Address is different from your Billing
Address."

I wanted a tick box and then if the box is ticked then the information about
the delivery address is revealed.

Can someone tell me if this involves javascript as well as css to handle this,
and if so can you tell me what the code would be like?

Appreciate any offered.



  Réponse avec citation
Vieux 24/02/2008, 15h48   #2
Ken Ford - *ACE*
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hide/reveal xhtml element via a tick box

Like this?

<script type="text/javascript">
<!--
function show(elementID) {
var myElement = document.getElementById(elementID);
if (myElement) myElement.style.display = "block";
}
//-->
</script>

<input type="checkbox" name="delivery" id="delivery" onclick="show('myDiv')"
/>
<div id="myDiv" style="display:none">
<input type="text" name="DeliveryAddress" id="DeliveryAddress" />
</div>

Or like this:

<input type="checkbox" name="delivery" id="delivery"
onclick="document.getElementById('myDiv').style.di splay='block';" />
<div id="myDiv" style="display:none">
<input type="text" name="DeliveryAddress" id="DeliveryAddress" />
</div>

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"gwhPoster" <webforumsuser@macromedia.com> wrote in message
news:fprk4a$os8$1@forums.macromedia.com...
> Hi everyone,
>
> I've got a form that consists of 3 parts. The first part has all the
> fields
> for the billing address, the second is for the delivery address, and the
> third
> is for the username and password etc. I wanted the second section about
> the
> delivery address to be hidden and for there to be a message saying:
>
> "Please "tick" if your Delivery Address is different from your Billing
> Address."
>
> I wanted a tick box and then if the box is ticked then the information
> about
> the delivery address is revealed.
>
> Can someone tell me if this involves javascript as well as css to handle
> this,
> and if so can you tell me what the code would be like?
>
> Appreciate any offered.
>
>
>


  Réponse avec citation
Vieux 24/02/2008, 16h39   #3
gwhPoster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hide/reveal xhtml element via a tick box

Thanks so much for the code. The first example worked really well. When the box
is ticked the element expands to show the delivery fields - the only problem is
that when you try to untick it, the element doesn't collapse again. Is it hard
to do this, ie. is there much more code to add?

  Réponse avec citation
Vieux 24/02/2008, 17h12   #4
Ken Ford - *ACE*
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hide/reveal xhtml element via a tick box

<script type="text/javascript">
<!--
function show(elementID) {
var myElement = document.getElementById(elementID);
if (myElement.style.display == "none") {
myElement.style.display = "block";
}
else {
myElement.style.display = "none";
}
}
//-->
</script>

<input type="checkbox" name="delivery" id="delivery" onclick="show('myDiv')"
/>
<div id="myDiv" style="display:none">
<input type="text" name="DeliveryAddress" id="DeliveryAddress" />
</div>


--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"gwhPoster" <webforumsuser@macromedia.com> wrote in message
news:fps33h$a6v$1@forums.macromedia.com...
> Thanks so much for the code. The first example worked really well. When
> the box
> is ticked the element expands to show the delivery fields - the only
> problem is
> that when you try to untick it, the element doesn't collapse again. Is it
> hard
> to do this, ie. is there much more code to add?
>


  Réponse avec citation
Vieux 24/02/2008, 17h50   #5
gwhPoster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hide/reveal xhtml element via a tick box

Thanks again - works perfectly now.

By the way, can you tell me if that big image in the background of this
forum's page, ie. the grey image, is just one big image that they've put in the
body tag? Wasn't sure because I thought that images needed to be cut into
smaller files for easier download.

  Réponse avec citation
Vieux 24/02/2008, 17h54   #6
Ken Ford - *ACE*
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hide/reveal xhtml element via a tick box

One file.

You don't need to break up images.

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"gwhPoster" <webforumsuser@macromedia.com> wrote in message
news:fps79e$ede$1@forums.macromedia.com...
> Thanks again - works perfectly now.
>
> By the way, can you tell me if that big image in the background of this
> forum's page, ie. the grey image, is just one big image that they've put
> in the
> body tag? Wasn't sure because I thought that images needed to be cut into
> smaller files for easier download.
>


  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 06h07.


Édité par : vBulletin® version 3.7.4
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,11284 seconds with 14 queries