Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ONMOUSEOVER/ONMOUSEOUT in ASP

Status
Not open for further replies.

Sensibilium

Programmer
Apr 6, 2000
310
GB
Below is the NOT-WORKING VBScript code for my products navigation:

[tt]<%
rsProdType.MoveFirst
Do Until rsProdType.EOF
Response.Write &quot;<a class=nav href='prodtype.asp?type=&quot; & rsProdType(&quot;ProductType&quot;) & &quot;' &quot;
Response.Write &quot;onmouseover=window.status='&quot; & RsProdType(&quot;StatusText&quot;) & &quot;'; return true; &quot;
Response.Write &quot;onmouseout=window.status=''; return true;>&quot;
Response.Write rsProdType(&quot;ProductType&quot;) & &quot;</a>&quot;
rsProdType.MoveNext
If Not rsProdType.EOF Then Response.Write &quot; | &quot;
Loop
%>[/tt]

Can anyone tell me how to create the onmouseover & onmouseout events WITHIN the ASP code? IE complains that there is an unterminated string...

Here is what the tag would look like in normal HTML:

[tt]<a class=&quot;nav&quot; href=&quot;prodtype.asp?type=Tableware&quot;
onmouseover=&quot;window.status='Tableware'; return true&quot;
onmouseout=&quot;window.status=''; return true&quot;>[tt]

Obviously I need to find a way to represent the double-quotes for onmouseover and onmouseout and replacing them with single quotes doesn't help because of the single quotes used for the window.status text.
 
unterminated string means you're not ending the &quot;
so view the clientside script(the HTML after you get it) and see where it's not finishing the quotation. also check to see if you use a backslash anywhere, this can typically cause problems, as they are character delimiters of javascript.

also to do a doublequote output, just do this &quot;&quot; that'll be represented as a doublequote in the ASP response string

for example

neat = &quot;&quot;&quot;quote&quot;&quot;&quot;

neat would be shown as &quot;quote&quot;
(the outer &quot; &quot; to hold it, and then the &quot;&quot; &quot;&quot; to represent the double quote)
 
Thanks for your help Karl, I don't know whether your solution would work, but I know that the following does:

[tt]
<%
rsProdType.MoveFirst
Do Until rsProdType.EOF
Response.Write &quot;<a class=nav href='prodtype.asp?type=&quot; & rsProdType(&quot;ProductType&quot;) & &quot;' &quot;
Response.Write &quot;onmouseover=&quot; & Chr(34) & &quot;window.status='&quot; & RsProdType(&quot;StatusText&quot;) & &quot;'; return true;&quot; & Chr(34) & &quot; &quot;
Response.Write &quot;onmouseout=&quot; & Chr(34) & &quot;window.status=''; return true;&quot; & Chr(34) & &quot;>&quot;
Response.Write rsProdType(&quot;ProductType&quot;) & &quot;</a>&quot;
rsProdType.MoveNext
If Not rsProdType.EOF Then Response.Write &quot; | &quot;
Loop
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top