radio buttons

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

radio buttons

Post by wizzard »

Hello,

I'm working on my shopping cart and i want something if the user
Choose the creditcard radio button then he can choose from the shipment method also with radio buttons ups, express mail buttons. If he choose COD he can only choose express mail. I don't know if this is possible with javascript and it will works for iexplorer and netscape.

Regards
Kris
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

You can disable form-elements from javascript.

Check this for code-samples:

http://www.codetoad.com/javascript/enab ... lement.asp
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Post by wizzard »

And hiding fields?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

hidden form-fields cannot be disabled or trigger events.
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Post by wizzard »

i mean can you hide fields with javascript? Like when the user press a button that some fields are hidden
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Never tried it - I find it hard to image that that would work, but do give it a try and let post your experience! :)
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

yes it does definatly work

Code: Select all

<input type="button" value="a button" onclick="hideme(this)">
<script language="javascript">
function hideme(obj) &#123;
  obj.style.visibility="hidden";
&#125;
</script>
all css attributes are available thru javascript
you may also want to set obj.style.display="none" to completly remove the object from the normal flow.
check the w3c pages for css level1 and 2 reference
Post Reply