Link to home
Start Free TrialLog in
Avatar of Darkejo1
Darkejo1

asked on

How to add variable to an HREF in ASP using vbscript

I'm trying to do the following:

<% TestStatement = "This Variable works" %>
<a href="Page.asp">TestStatement</a> 

Open in new window


So the page would read "This Variable works" as a hyperlink and would direct the user to page.asp.

Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Ought to work ... is javascript the language at that point ... a quick test with:


<%SCRIPT=JAVASCRIPT TestStatement = "This Variable works" %>
<a href="Page.asp">TestStatement</a><div id="masthead">

in an html page forwards as required.

Chris
Avatar of Darkejo1
Darkejo1

ASKER

I'm not familiar with JavaScript as I'm using VBScript. When I add suggestion, I receive Expected end of statement:

Script=JAVASCRIP TestStatement = "This Variable works"

Open in new window


At the letter "T" in Test.
I was able to get rid of that error message. This is what I have so far.

<%Language=JAVASCRIPT%>
<%Teststatement="This Variable Works"%>
<a href="Page.asp">TestStatement</a><div id="masthead">

Open in new window


The Result is "TestStatment" as a hyperlink. Instead, it should say "This Variabel Works" as they hyperlink.

I realised after my post I was in error ... and am currently making silly mistakes in extremis.

I will try to clear the fog from my mind or see someone else help you before I succeed.

Chris
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Worked like a charm! Thanks!!
And i'm sorry for not understanding earlier what was required ... but glad you have a solution.

Chris