/    Sign up×
Community /Pin to ProfileBookmark

Coding Help

Hi,

I’m trying to make a webpage do the following.

Say I have a drop down box. After the user selects an option from the drop down box, I’m assuming I can do this with the onchange event, another set of options will appear that the user can select from. If the user selects a different option from the drop down box, some options will dissapear and new ones will become available. I’m assuming that I can do this with javascript.

Just not sure how to go about doing so. Anyone have a simple example for me to look at so I can figure out where to go or know of a good tutorial for me to read.

Thanks

Mike

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@TheSpiritNov 22.2002 — well, there are two ways I know of, but one I am unsure of the calls to get it to work. In order to do that, you'd have to have an onchange and you would want to use document.all.whatever.value (if value is what you use in a select box to add a selection value to it), which would add the new selection items into the box.

The second way is to create the dropdowns you want and set a style property in their HTML tag style='display=none' (which only works in MSIE 6.0 so far as I have seen) OR style='visibility=hidden' (which works across platforms, but still leave the space where the new dropbox would be originally) as well as giving each item its own ID tag. When you do the onchange, have it check to see if the desired dropbox is visible and then proceed to make it visible and hide the other dropboxes. Here is an example of something along those lines. If you need a specific example, lemme know.

<td class=topic width=50% id="+linkname+" onclick='if (document.all."+linkname+"b.style.display==none) { document.all."+linkname+"b.style.display=block } else { document.all."+linkname+"b.style.display=none };'><font class=sizetpc>"+title+"</font> <font class=size1>.:"+date+":.</font></td>

linkname was defined in the function call that this onclick and <td> are contained in. This is a table which allows you to click the title and either display or hide the body of the table. Keep in mind that the display css property has only worked in MSIE 6.0 for me. Any questions?
Copy linkTweet thisAlerts:
@TheSpiritNov 22.2002 — Also, where you see the ==none or =none or =block, I was forced to define those with vars previously, so quote your styles, i.e.:

document.all."+linkname+"b.style.display=="none")
Copy linkTweet thisAlerts:
@mikeauthorNov 27.2002 — Thanks,

I tried what you said about using the style.display = 'none' and it works great. I just have a few follow up questions. How do I get the text to be visible/invisible? I made the text box disappear but I can still see the text that say enter xyz here. Can I disable the submit button? or make it not visible.

I also have one more problem. I'm using a fieldset tag to hold some radio buttons. How to I access the fieldset object to set it's properties with javascript.

say I have something like

<fieldset name="selectRange">

<legend>Select Range</legend>

<input type="radio" value="V1" name="R1">Date Range

<input type="radio" value="V2" name="R1">Uid Range

</fieldset>

How would I access it? I've tried document.selectRange.* but it says not a valid object.

ideas? Thanks

Mike
Copy linkTweet thisAlerts:
@tomroten_10Nov 28.2002 — Here is a great tutorial that I think has what you are thinking about. http://hotwired.lycos.com/webmonkey/98/04/index3a_page10.html?tw=programming

Take a look at it. When you choose a option from the pulldown menu a new box appears to the left. It changes depending on what you choose. If you can't incorporate into your page then just give me all of the details and I will create a script for you.
Copy linkTweet thisAlerts:
@mikeauthorDec 02.2002 — Thanks

I'll go take a look and see how it works

If anything I'll need some help with debugging.

k

M
×

Success!

Help @mike spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...