Click to See Complete Forum and Search --> : Implementing Javascript within ASP


betheball
02-18-2005, 09:07 AM
I use the following code to display a DHTML tooltip:

<a href="javascript:void(0)" ONMOUSEOVER="ddrivetip('Display tip.','#003063')"; ONMOUSEOUT="hideddrivetip()">

I need to use the same code within a For/Next loop in ASP and replace "Display tip." with a variable. Can't quite get the syntax. The following does not throw an error, but the tip does not display:

<%
For i = 0 to UBound(arrRS2,2)
Response.write "<tr><td>"&arrRS2(0,i)&"</td><td>"
Response.write "<a href='javascript:void(0)' ONMOUSEOVER='ddrivetip('"&arrRS2(2,i)&"','#003063')'; ONMOUSEOUT='hideddrivetip()' class='help'>"&arrRS2(1,i)&"</a></td></tr>"
Next
End If
%>

I think it's this portion that isn't quite right:

ONMOUSEOVER='ddrivetip('"&arrRS2(2,i)&"','#003063')';

Any thoughts?

betheball
02-18-2005, 11:57 AM
Not sure this is proper, but this seemed to do the trick. I changed:

ONMOUSEOVER='ddrivetip('"&arrRS2(2,i)&"','#003063')';

to

ONMOUSEOVER=""ddrivetip('"&arrRS2(2,i)&"','#003063')"";

phpnovice
02-18-2005, 05:08 PM
Originally posted by betheball
The following does not throw an error, ...
Then you have error reporting turned off in your browser. ;-)
One thing to keep in mind... When sending HTML to the client, you always want to be sending double-quotes, not single-quotes. Save the single quotes for the JavaScript -- as in your case.