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!

Variables in HTML

Status
Not open for further replies.

ivan8r

Programmer
Jul 13, 2001
3
US
I'm new to web development, and I can't figure out how to take a value from a drop-down list and use that value in a hyperlink. I've set up my values in the drop-down field, but can't seem to get my hyperlink to read the value of the selected option. Here's my code:

Drop-down list:

<form name=&quot;baseball_size&quot;>
<select name=&quot;baseball&quot; onChange=&quot;MM_jumpMenu('parent',this,0)&quot;>
<option selected>Size...</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-S&CARELLOCODE=PCMI&quot;>Small</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-M&CARELLOCODE=PCMI&quot;>Medium</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-L&CARELLOCODE=PCMI&quot;>Large</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-XL&CARELLOCODE=PCMI&quot;>XLarge</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-XXL&CARELLOCODE=PCMI&quot;>XXLarge</option>
<option value=&quot;/scripts/Carello/Carello.dll?VBEXE=e:/inetpub/scripts/Carello/Add.exe&ITEMNUM=42-EMB-XXXL&CARELLOCODE=PCMI&quot;>XXXLarge</option>
</select>
</form>

And here's the code for the hyperlink:

<a href=&quot;$baseball&quot; onMouseOut=&quot;MM_swapImgRestore()&quot; onMouseOver=&quot;MM_swapImage('Image9','','../images/cart6-over.gif',1)&quot; target=&quot;CARTLIST&quot;><img name=&quot;Image9&quot; border=&quot;0&quot; src=&quot;../images/cart6.gif&quot; width=&quot;78&quot; height=&quot;64&quot;></a>

I'm guessing that there's something very simple that I'm missing here. I'm trying to teach myself, and now I'm stuck.

 
my best guess for what you are look for, would be to write a script that passes the value of the selected option to a javascript fuction that sets the value of the form and submits it eg

function jump()
{
var t
t = document.selectboxname.list.value;
document.formname.action=&quot;your_page.asp?&quot;+t;
document.members.submit();
}

not sure if this will help it might give you some ideas
 
hie ivan,
u shuld rite ur link this way:
<script language=&quot;javascript&quot;>
var tmp=document.forms.baseball_size.baseball[document.forms.baseball_size.baseball.selectedIndex].value
var str=&quot;&quot;
str+=&quot;<a href=\&quot;&quot;+tmp+&quot;\&quot; onMouseOut=\&quot;MM_swapImgRestore()\&quot; onMouseOver=\&quot;MM_swapImage('Image9','','../images/cart6-over.gif',1)\&quot; target=\&quot;CARTLIST\&quot;><img name=\&quot;Image9\&quot; border=\&quot;0\&quot; src=\&quot;../images/cart6.gif\&quot; width=\&quot;78\&quot; height=\&quot;64\&quot;></a>&quot;
document.write(str)
</script>

but it will work opnly with static link (that is generating in the process of page parsing)
so, u have 2 mess with layers/spans/divs & innerHTML (for ie)
if it is what u're for, let me kno - i (or someone else here) will do smth for ya.. regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top