Functions = Type mismatch

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    Functions = Type mismatch

    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="<%=evalu tateSwitch(high lightSwitch)%>" ></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]

    #2
    Re: Functions = Type mismatch

    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" <anonymous@disc ussions.microso ft.com> wrote in message
    news:044201c536 3e$7f70fa70$a50 1280a@phx.gbl.. .[color=blue]
    > 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="<%=evalu tateSwitch(high lightSwitch)%>" ></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[/color]


    Comment

    Working...