Hi all,
Just a quick question (I hope). I have a form with with lots of drop-down menus containing long, horrible medication names, which are outputted to a page for the user to print. I’ve been asked if I can make images of the selected drug appear on the outputted page, but I’ve hit a snag as to the best way to do it.
At the moment, a typical option looks like:
<option value="Seretide 50/25mcg puffer">Seretide 50/25mcg puffer</option>
And I access it using:
document.form.foo.value
My thought was to use the value to construct the image name, like so:
"<img src='images/" + document.form.foo.value + ".jpg'>"
Which is all fine and dandy, except a filename like ‘Seretide 50/25mcg puffer.jpg’ isn’t exactly ideal.
If I were to stick to that method of constructing the image names using simplified values, how might I output the full drug name? What do I use instead of value? Or, what would be a better way to generate the image names?
Thanks in advance!