Functions = Type mismatch

Discussion in 'ASP General' started by James, Mar 31, 2005.

  1. James

    James Guest

    Could you help me understand why this isn't working. I
    have a function:

    Function evaluateSwitch(x)
    if x = "T" then
    evaluateSwitch = "border"
    else
    evaluateSwitch = "altborder"
    end if
    End Function


    When I do this:
    response.write evaluateswitch(highlightSwitch)

    It displays correctly (border)

    But when I try to incorporate it into a division like this:
    <div class="<%=evalutateSwitch(highlightSwitch)%>"></div>

    It does not work and gives me a type mismatch error. Do
    you have any ideas on why this isn't working.

    Thanks,

    James
    James, Mar 31, 2005
    #1
    1. Advertising

  2. Put "Option Explicit" at the top of the page. Getting into the habit of
    doing so will avoid such confusion and immediately alert you to the fact
    that you have a typo.

    Ray at work

    "James" <> wrote in message
    news:044201c5363e$7f70fa70$...
    > Could you help me understand why this isn't working. I
    > have a function:
    >
    > Function evaluateSwitch(x)
    > if x = "T" then
    > evaluateSwitch = "border"
    > else
    > evaluateSwitch = "altborder"
    > end if
    > End Function
    >
    >
    > When I do this:
    > response.write evaluateswitch(highlightSwitch)
    >
    > It displays correctly (border)
    >
    > But when I try to incorporate it into a division like this:
    > <div class="<%=evalutateSwitch(highlightSwitch)%>"></div>
    >
    > It does not work and gives me a type mismatch error. Do
    > you have any ideas on why this isn't working.
    >
    > Thanks,
    >
    > James
    Ray Costanzo [MVP], Mar 31, 2005
    #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. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    626
    Karl Seguin
    Aug 10, 2005
  2. type mismatch error

    , Aug 12, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,341
    Kevin Spencer
    Aug 12, 2005
  3. Artie Gold

    Re: type mismatch

    Artie Gold, Feb 28, 2004, in forum: C Programming
    Replies:
    0
    Views:
    389
    Artie Gold
    Feb 28, 2004
  4. Laura
    Replies:
    4
    Views:
    152
    Joe Iano
    Jul 24, 2003
  5. programmingzeal
    Replies:
    0
    Views:
    1,093
    programmingzeal
    May 6, 2012
Loading...

Share This Page