Click to See Complete Forum and Search --> : Dropdown Box with d/load button


moondance
07-22-2003, 09:35 AM
How do people do those boxes (like a combo box in VB, i think they're called list/menu boxes in dreamweaver) ?

I've seen them before used for navigation.

What i need is a few items in the drop down list, with a download button, and when the user clicks on the button it will download the file thats selected in the dropdown box.
:confused:

Cheers

ps i just realised the exact thing i want is at the bottom of this forum - jump to a forum page, but how can i download the selected item?

pyro
07-22-2003, 09:44 AM
Try something like this:

<form>
<select name="download">
<option value="http://www.yoursite.com/file1.zip">File 1</option>
<option value="http://www.yoursite.com/file2.zip">File 2</option>
</select>
<input type="button" value="Download" onclick="window.location.href=this.form.download.options[this.form.download.selectedIndex].value;">
</form>

moondance
07-22-2003, 09:55 AM
wow thanks for the quick reply pyro, that works great


:D

pyro
07-22-2003, 09:58 AM
You're welcome... :)

moondance
09-19-2003, 03:27 AM
sorry for brushing the cobwebs off this one, but i just found an error that i never realised before :eek:

i made it like this:

<Select name = "download">
<option>Previous Issues</option>
<option value = downloads/Issue1>Issue 1</option>
<option value = downloads/Issue2>Issue 2</option>
<option value = downloads/Issue3>Issue 3</option>
</select>

Then the code pyro gave me:

<input type = "button" value = "download" onclick = "window.location.href = this.form.download.options[this.form.download.selectedIndex].value;">

If I keep it on the default option, Previous Issues, and click download, i get an error/ debug message. Is there any way to avoid this?

thanks

pyro
09-19-2003, 07:10 AM
Try this:

<select name="download">
<option value="javascript:void(0)">Previous Issues</option>
<option value="downloads/Issue1">Issue 1</option>
<option value="downloads/Issue2">Issue 2</option>
<option value="downloads/Issue3">Issue 3</option>
</select>with no space in javascript...

moondance
09-19-2003, 08:12 AM
thats works a treat

thanks pyro

:D

pyro
09-19-2003, 08:22 AM
You bet... :)