Click to See Complete Forum and Search --> : button that activates drop-down menu
ssoltz
04-24-2003, 09:13 AM
Hello,
I am new to this forum and not an expert at Javascript.
Here's what I'd like to do:
I have a normal jump menu, originally generated with Dreamweaver MX. It uses an 'onChange' action to jump to other pages. What I need is to have a button that activates the jump menu. In other words, I want a button that has the same result as pushing the normal down arrow that resides on the right side of a normal jump menu / drop down box. The button will be to the left of the jump menu.
Can anyone instruct me on how to do this?
Thanks in advance,
<html><head>
<script>
function goto(page){location=page;}
</script></head><body>
<form name="myForm">
<select size="1" name="myBox">
<option selected value="index.html">Home</option>
<option value="about.html">About</option>
<option value="somepage.html">Another Example</option>
</select><br>
<input type=button value="Go!" onClick="goto(this.form.myBox.options.selectedIndex.value);"
</form>
ssoltz
04-24-2003, 09:51 AM
O.K...the answer you gave is for a normal button that would activate the jump and goto the new page.
What I want is to be able to simply 'pull down' the menu from outside of the jump menu box itself. Basically the same function as the drop-down arrow provides. I don't want to actually go anywhere...yet!
Can I do this by changing focus? And if so, how?
Thanks again,
Originally posted by ssoltz
...What I want is to be able to simply 'pull down' the menu from outside of the jump menu box itself. Basically the same function as the drop-down arrow provides...
You mean like, "create your own" select box? Please explain this part better--I don't quite understand that. ;)
ssoltz
04-24-2003, 10:09 AM
Thanks for your time, first of all...
Basically, there is a graphic to the left of the drop-down menu. The drop down is a typical jump menu that goes to a specific page. It uses the onClick action so that when the page is selected, it goes to the page. This all stays the same.
What my client wants is when the user clicks on the graphic, instead of the jump menu's down arrow, the jump menu expands to reveal the different jump menu options...just like the down arrow on the drop-down itself would do...
Is that clearer?
Thanks again!
I think so.... You mean you have a graphic that, when clicked, changes the options available in the select menu? (If that's not what you want, do you mean that a graphic onclick, opens the dropdown menu?)
ssoltz
04-24-2003, 10:24 AM
the second...all I want is for an onClick (as an action on a separate button) that opens the jump menu...like I said, I'm not very knowledgeable as far as JS!
Thanks,
Wow! Hey, it looks like a new question! :p Okay, let me think for a while.... I'm not entirely sure this is even possible...
tim_gor
04-24-2003, 10:26 AM
I think I know what want -- basically that you have page with a dropdown menu (a SELECT box in a form) and a graphic
You want to be able to click on the graphic in order to see the menu items in the dropdown menu right? (i.e. to open the dropdown menu)
However, I don't think what you're trying to do is possible with a normal form. Check out the properties for the SELECT object
http://www.devguru.com/Technologies/ecmascript/quickref/select.html
There is no method within the SELECT object to expand its menu. Focus will only "select" the SELECT object -- not actually open the menu itself.
I think if you really wanted to achieve that effect, you would effectively have to program your own dropdown menu, so that the menu items appear in a layer of some sort. It will require a lot more work, though I'm sure you can charge your client accordingly! :P
ssoltz
04-24-2003, 10:28 AM
yes, I was afraid of that...
I now know that using focus won't work...focus won't open the drop-down...
my initial feeling was that it couldn't be done in this way...I was going to recommend to the client that if he wants something like this, he will need to use layers...
Thanks Jonah...let me know if you come up with anything...
I have checked and I do not believe this to be possible. It may be better if you try going to http://javascript.internet.com/navigation/cool-pulldown-menu.html and using that...