Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use a variable in an <OPTION>

Status
Not open for further replies.

wudz

Programmer
Mar 28, 2001
135
GB
Hi,

My apologise in advance, just jumped here for advice from the Flash graphics forum and know very little about Javascript syntax..

I want modify a freebe javascript dropdown menu giving a small popup, is it possible to insert a variable in the <OPTION> or in any other section of the script or just start again with a new script...


I tried...

<option value="./business_cards/$TPL_area/any.html">test1
futher 18 <option values,,,,,,,test19

no joy...

$TPL_area is a folder name, I wish to use different folders depending on the area of the signed in person rather than have to duplicate all nineteen lines 25 times using if statments for all the areas I cover...

So I ask is it possible to crack my problem...

As a cherry on the cake I would also like it to stay on the top

Cheers in advance

John
 
It is inadmissible to start a variable with $ sign in javascript, so I think you might be thinking php. In that case, that is sent at serving time. Try something like this?
[tt] <option value="./business_cards/<?php echo $TPL_area ?>/any.html">[/tt]
And the rest the same way?
 
Thanks tsuji,

Quite right pulled the variable from the PHP script and the answer seems obvious to me now....but old age and no Java skills made me try the wrong syntax...

Thanks for your speedy reply, much appreciated.


John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top