follow-up to fp2003 drop-down, file format

N

Nina Harris

I would like to give an option to display two file formats to users, one
plain html, the other is a gif

files are all located in a common folder, like c:\temp\first.html and
c:\temp\first.gif

when I populate the drop-down box with the html files, user clicks and it
displays normally on another window or another frame (this part works fine
and I don't wish to change the behaviour)

all I would like to add is the ability to change the default drop-down list
from showing the "first.html" to "first.gif" and to allow them to load
either item or switch between them

currently I can solve it two ways
1. I can preload the drop-down with both the html and gif format (in the
list of option choices)
2. I can have two drop-down lists, one after the other and user selects
between the two

can I somehow combine the above two approaches with a simple switch option?
 
M

MD Websunlimited

Hi Nina,

Assuming that both have the same file name use a checkbox or radio buttons, next to the select, to determine what the file
extension will be. In the code just sub in the extension.

onchange="ext = '.htm'; if(C1.checked) {ext = '.gif'}; alert(this.options[this.selectedIndex].value + ext);"

The above displays the file name, I leave the link up to you.
 
N

Nina Harris

MD wrote
onchange="ext = '.htm'; if(C1.checked) {ext = '.gif'};
alert(this.options[this.selectedIndex].value + ext);"
The above displays the file name, I leave the link up to you.

ok, inserted a checkbox, named default C1
this displays only the html version, not the gif version unless I change it
around
then it shows only the gif version and not the html version

method-1
<select
onchange="ext='.html';if(C1.Checked){ext='.gif'};parent.main.location=this.o
ptions[this.selectedIndex].value + ext" size="1" name="D1">

method-2
<select
onchange="ext='.gif';if(C1.Checked){ext='.html'};parent.main.location=this.o
ptions[this.selectedIndex].value + ext" size="1" name="D1">
 

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