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

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

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. Gabriele Zannoni

    ASP + ASP.NET + VBScript + C#?

    Gabriele Zannoni, Sep 8, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    859
    Marina
    Sep 8, 2004
  2. Showjumper
    Replies:
    1
    Views:
    829
    Showjumper
    Mar 19, 2005
  3. Roja Doja
    Replies:
    2
    Views:
    3,520
    Roja Doja
    Apr 14, 2005
  4. srini
    Replies:
    7
    Views:
    10,306
    praveen synergy
    Aug 30, 2010
  5. morrell
    Replies:
    1
    Views:
    1,191
    roy axenov
    Oct 10, 2006
  6. Joe
    Replies:
    2
    Views:
    508
    Martin Honnen
    Apr 25, 2009
  7. John Davis

    ASP JavaScript versus ASP VBScript

    John Davis, Sep 6, 2003, in forum: ASP General
    Replies:
    5
    Views:
    244
    Curt_C [MVP]
    Sep 7, 2003
  8. Dustin II.
    Replies:
    1
    Views:
    541
Loading...