Pass ASP Variable to Javascript with href

I am working on a custom built ASP 3.0 and SQL site that is being used to track calls and issues within our department.

I am working on our reports page and have generated a bar graph that dynamically shows the volume of calls each client generates.  I did this by passing an ASP variable into a Javascript program that creates the graph.  What I would like to do now is make the clients name within the graph a hyperlink to a detail report page that would query all of that clients tickets based on a querystring.  I know how to do all of that except for getting the Javascript to accept the anchor.

I tried modifying the code, which resulted in the graph not rendering at all (which was half what I expected to happen but, was the only thing I could think of at the time).  The modification I made is shown at the end of the code section
'****************************************************************
'Client Totals - ALL
'****************************************************************
	Dim RSClientTotals, SQLClientTotals
		
	Set RSClientTotals = Server.CreateObject("ADODB.Recordset")
	Call OPEN_DB
	SQLClientTotals = "SELECT COUNT(ClientEmplID) as TicketTotal, ClientLName, ClientFName FROM ticketinformation GROUP BY ClientLName, ClientFName ORDER BY ClientLName, ClientFName"
	Set RSClientTotals = MyConn.Execute(SQLClientTotals)

	'****************************************************************
	'Create Graph Values
	'****************************************************************
		Dim ClientTotals, ClientLabels, iRecClientTotals 
		iRecClientTotals = 0
		If NOT RSClientTotals.EOF Then
			While NOT RSClientTotals.EOF
				If  iRecClientTotals = 0 Then
					ClientTotals = RSClientTotals("TicketTotal")
					ClientLabels = RSClientTotals("ClientLName")
				Else					
					ClientTotals = ClientTotals & "," & RSClientTotals("TicketTotal")
					ClientLabels = ClientLabels & "," & RSClientTotals("ClientLName")
				End If			
			iRecClientTotals = iRecClientTotals + 1
			RSClientTotals.MoveNext
		Wend
		End If
		ClientTotals = """" & ClientTotals & """"
		ClientLabels = """" & ClientLabels & """"
		'response.write ClientTotals
		'response.write ClientLabels
			
			
			
	
%>
<script type="text/javascript"> 
<!--
var showValues, barWidth, barLength, labelSize, absValuesSize, percValuesSize, graphPadding, graphBGColor, graphBorder, barColors
var barBGColor, barBorder, labelColor, labelBGColor, labelBorder, absValuesColor, absValuesBGColor, absValuesBorder
showValues = 1;
barWidth = 20;
barLength = 1;
labelSize = 12;
absValuesSize = 12;
percValuesSize = 12;
graphPadding = 10;
graphBGColor = "#CACCB4";
graphBorder = "1px solid #DEDECF";
barColors = "#898B5E";
barBGColor = "#CACCB4";
barBorder = "2px outset #DEDECF";
labelColor = "#000000";
labelBGColor = "#DEDECF";
labelBorder = "2px groove #DEDECF";
absValuesColor = "#000000";
absValuesBGColor = "#CACCB4";
absValuesBorder = "2px groove #CACCB4";

//--> 
</script>
		<table>
			<tr>
				<td valign="top">
					<table border="1">
						<tr>
							<td align="center" style="font-weight:bold" colspan="2">TODAY</td>							
						</tr>
						<tr>
							<td align="center" style="font-weight:bold">Cases by Tech</td>
							<td align="center" style="font-weight:bold">Cases by Status</td>							
						</tr>
						<tr>
							<td valign="top">
								<script type="text/javascript"> <!--
									var TicketValuesT
									var TechLabelsT						
									TicketValuesT = <%=TicketValuesT%>
									TechLabelsT = <%=TechLabelsT%>
									var graph = new BAR_GRAPH("hBar");
									graph.values = TicketValuesT;
									graph.labels = TechLabelsT;
									graph.showValues = showValues;
									graph.barWidth = barWidth;
									graph.barLength = barLength;
									graph.labelSize = labelSize;
									graph.absValuesSize = absValuesSize;
									graph.percValuesSize = percValuesSize;
									graph.graphPadding = graphPadding;
									graph.graphBGColor = graphBGColor;
									graph.graphBorder = graphBorder;
									graph.barColors = barColors;
									graph.barBGColor = barBGColor;
									graph.barBorder = barBorder;
									graph.labelColor = labelColor;
									graph.labelBGColor = labelBGColor;
									graph.labelBorder = labelBorder;
									graph.absValuesColor = absValuesColor;
									graph.absValuesBGColor = absValuesBGColor;
									graph.absValuesBorder = absValuesBorder;
									document.write(graph.create());
								//--> 
								</script>
							</td>






'***********
'Modification
'***********

If  iRecClientTotals = 0 Then

ClientTotals = RSClientTotals("TicketTotal")
ClientLabels = "<a href=""#"">" & RSClientTotals("ClientLName") & "</a>"

Else					

ClientTotals = ClientTotals & "," & RSClientTotals("TicketTotal")
ClientLabels = ClientLabels & "," & "<a href=""#"">" & RSClientTotals("ClientLName") & "</a>"

End If

Open in new window

LVL 3
LouSch7Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

webwyzsystemsCommented:
I think you need to escape your quotation marks so they are literally applied in your code.

You can't send something like this:

link="some text here" + "some "quote" marks"

that's a syntax error. You have to do this:

link="some text here" +  "some \"quote\" marks"

Preceding your quotations with a reverse slash (\) escapes them so that whatever character follows is output rather than interpreted.

0
LouSch7Author Commented:
webwyzsystems:

I attempted to use your escape suggestion as shown in the attached code...It resulted in the following error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test/members/Reports.asp, line 314, column 47
ClientLabels = ClientLabels & "," & "<a href=\"#\">" & RSClientTotals("ClientLName") & "</a>"
ClientLabels = ClientLabels & "," & "<a href=\"#\">" & RSClientTotals("ClientLName") & "</a>"

Open in new window

0
webwyzsystemsCommented:
oops...my bad. I was thinking in terms of every other programming language OTHER than VB.

I think in VB you have to use three double quotation marks to get a single double quote in the output.

ClientLabels = ClientLabels & "," & "<a href="""#""">" & RSClientTotals("ClientLName") & "</a>"
0
Om PrakashCommented:
3 quotes will give uou an error. Only 2 double quotes are sufficient:

ClientLabels = ClientLabels & ",<a href=""#"">" & RSClientTotals("ClientLName") & "</a>"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.