nt*****@hotmail.com wrote:
I am trying to make a variable link on a page. The page has a text box
for a stock symbol. The code is: <input type=TEXTBOX Name="symtb"
value="" size="10>
The value of the text box {the stock symbol} will complete the url.
I found code for a variable link:
<script language="JavaScript">
<!--
function variable_in_link(varible_value)
{
new_win = window.open('http://finance.yahoo.com/q?s=" +
varible_value'')
}
// -->
</script>
The link I am trying to use is: <a
href="javascript:variable_in_link(symtb)">The text</a>
No matter what I do the variable_value comes back as undefined. There
is always a value in the text box.
Any ideas what is going on?
thanks
vm
You should change your script to something like this:
<script type="text/javascript">
function go_to_link(stocksymbol)
{
part_of_link = stocksymbol;
main_link = "http://finance.yahoo.com/q?s=";
full_link = main_link + part_of_link;
new_win = window.open(full_link);
}
</script>
Now change your <a> tag to say:
<a href="javascript
:go_to_link(symtb)">The text</a>
By the way, you added an extra quotation mark (") after varible_value
in your window.open. That may be your original flaw, but this is just
a way to make sure that there is no larger problem.
I have the honor to remain your most humble and Ob't Sv't in our war
against the King.
--
Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment