HTML Link in ASP VBSCRIPT block

Discussion in 'ASP .Net' started by requeth@gmail.com, Aug 8, 2008.

  1. Guest

    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
    %>
    , Aug 8, 2008
    #1
    1. Advertising

  2. 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

    <> wrote in message
    news:...
    > 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
    > %>
    Mark Fitzpatrick, Aug 9, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Showjumper
    Replies:
    1
    Views:
    699
    Showjumper
    Mar 19, 2005
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    809
    Kevin Spencer
    May 17, 2005
  3. srini
    Replies:
    7
    Views:
    9,897
    praveen synergy
    Aug 30, 2010
  4. morrell
    Replies:
    1
    Views:
    946
    roy axenov
    Oct 10, 2006
  5. Dustin II.
    Replies:
    1
    Views:
    367
Loading...

Share This Page