HTML Link in ASP VBSCRIPT block

  • Thread starter Thread starter requeth
  • Start date Start date
R

requeth

Hey, I havnt done ASP in a long time, and I think I'm forgetting
something. I have the following block, and it runs fine s long as the
HTML link code isint in, but if I put the code in I get a runtime
error. How do I get the HTML link to work?

<%
Dim a as string
Dim b as string
a = request.browser.browser
b = "IE"
if a <> b then
response.write( "You are using " & a & " to view this page. Please use
Internet Explorer.")
else

<a href="http://example.com/index.aspx">
<img src="./button.jpg" border="0">
</a>

end if
%>
 
You have to terminate the code block before you do the html. it
should be:

else %>
<a href="http://example.com/index.aspx"><img src="./button.jpg"
border="0"></a>
<% end if %>

The HTML should never be part of the vbscript code unless you are using a
response.write to output it to the browser.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
Back
Top