HTML or JAVA help

D

Dennis

Ok new question for you guys.. here is what I want to do,
but the only thing I am not sure of is that what I am
trying to do is HTML or Java... I have a Checkbox on my
web page that I am trying to make a drop down menu appear
once you click on the spacific checkbox.. for instance...
say someone wants to look at a windows OS you would have
the following options before you

Windows
(the dreaded)Mac
Linux
Unix
Multi-platform

Now once the box next to windows is checked it should
look something like this
X)Windows
(drop down menu)Win3.1
Win95
Win98
Win98SE
WinNT
ECT.
so basically this is what I have in HTML script if
someone could give me either the HTML script of JAVA
script that I would need to creat such an occurance that
would be great or just tell me how to do it that would be
good to

<input name="Windows" type="checkbox" id="Windows" />
Windows
<select name="Windows" size="1">
<option value="Win3.1">Win3.1</option>
<option value="Win95">Win95</option>
<option value="Win98">Win98</option>
<option value="Win98SE">Win98SE</option>
<option value="WinNT">WinNT</option>
<option value="WinME">WinME</option>
<option value="Win2000">Win2000</option>
<option value="WinXP">WinXP</option>
</select>
 
G

Guest

You could do something like this. It works in IE. I just tested it in IE but didn't test in Netscape. I made a few minor mods to your existing HTML so make note of them as well. In addition to adding a script function call on onclick event on the checkbox, I added a display style and id to the dropdownlist and it changed it's "name"

<head><script language=javascript
function myScript(

if (document.getElementById("cboWindows").style.display == 'none'

document.getElementById("cboWindows").style.display = 'block

els

document.getElementById("cboWindows").style.display = 'none



</script></head><body><input name="Windows" type="checkbox" onclick="myScript();" id="Windows" /
Window
<select id="cboWindows" name="cboWindows" size="1" style="DISPLAY: none"
<option value="Win3.1">Win3.1</option
<option value="Win95">Win95</option
<option value="Win98">Win98</option
<option value="Win98SE">Win98SE</option
<option value="WinNT">WinNT</option
<option value="WinME">WinME</option
<option value="Win2000">Win2000</option
<option value="WinXP">WinXP</option></select>
 
D

Dennis

Thanks your a life saver... don't know if I could have
ever figured it out.. thanks again
Dennis

-----Original Message-----
You could do something like this. It works in IE. I
just tested it in IE but didn't test in Netscape. I
made a few minor mods to your existing HTML so make note
of them as well. In addition to adding a script function
call on onclick event on the checkbox, I added a display
style and id to the dropdownlist and it changed
it's "name".
<head><script language=javascript>
function myScript()
{
if (document.getElementById
("cboWindows").style.display == 'none')
{
document.getElementById
("cboWindows").style.display = 'block'
}
else
{
document.getElementById
("cboWindows").style.display = 'none'
}
}

</script></head><body><input name="Windows"
type="checkbox" onclick="myScript();" id="Windows" />
 
G

Guest

and now when I add that to the Mac it doesn't wanna go..
is it because I don't have any choises.. and why does the
windows go away.. I changed the code a bit to compensate
for Mac.. but for some reason having both of them with
almost the same code the drop down menu disapears and is
now under Mac.. hmmmmmmmmm Who else can help with this or
can SkyDolphin help out again.. I will check in a little
while for any extra helpings..thanks again
 
A

Andrew Murray

Others might have more accurate suggestions, but you'd need javascript to check
the 'visible' or 'invisible' status of the drop down list depending on the one
you choose.

like

if checkboxWindows.visible = true {
dropdownWindows.visible = true
else dropdownWindows.visible = false.
}

and do this for all the other options.

The above code is probably wrong or simplified; I am just thinking back to my VB
course I did and transferring it to Javascript!

You could also do it instead of visible and invisible, have it "enabled" and
"disabled" (as in 'greyed-out' like you see in windows dialogues when options
aren't available).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top