Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: How can I make a link (HREF) in HTML text from a variable string


Message #1 by "Pedro" <rodriguepf@c...> on Wed, 26 Jul 2000 12:10:33
Yes, you could try something like this:

<A HREF="JavaScript:OpenPage(comp_ref)">Search Now</a>

Then create a function called OpenPage (or any other name) like this:

function OpenPage(sPageToShow)
{
         location.href = sPageToShow;
}

Optionally, you could use location.replace (no entry in the history list) 
or name a target frame as well (parent.frameName.location.href =......)

Imar


]

At 12:59 PM 7/26/2000 -0700, you wrote:
>The problem is as follows. I'm using a variable (comp_ref) in JavaScript to
>create a link that contains parameters which I must pass to another page
>(search.asp):
>
><script LANGUAGE="JavaScript">
>...
>comp_ref 
>eval('"'+"search.asp?nome="+name+"&localidade="+local+"&distrito="+district 
>+"&cozinha="+document.all.Listbox2.value+"&ambiente="+document.all.Listbox3 
>.value+"&preco="+document.all.Listbox3.value+
>'"');
></script>
>
>Then I want to use this variable outside javascript as a link to my
>'search.asp' page. Something like this:
>
><a href=comp_ref>Search Now</a>
>
>Is this possible? If not what should I do?
>Thanks for your time and attention...
>

  Return to Index