Type Mismatch Error

Discussion in 'Javascript' started by RICHARD BROMBERG, Jun 23, 2007.

  1. Can anyone tell me why I am getting the following VBScript runtime error


    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'fVALIDATEEMAIL'
    /JAVASCRIPT/VALIDATEEMAIL.asp, line 31

    Here is the code snippet that calls the fVALIDATEEMAIL function.
    Here is Line 31 answer=fVALIDATEEMAIL("") .
    The complete snippet is shown below

    <%
    dim email
    dim answer
    if Request.Querystring("isSubmitted") = "yes" then
    email=request.querystring("EMAILADDRESS")
    response.write("this is your email address " + "'" + email + "'")
    answer=fVALIDATEEMAIL("")
    end if
    %>


    The actual function is part of an external .JS file. All the other functions
    work fine.


    function fVALIDATEEMAIL("a")
    {
    fVALIDATEEMAIL="yes"
    end function
    }
    RICHARD BROMBERG, Jun 23, 2007
    #1
    1. Advertising

  2. RICHARD BROMBERG

    Randy Webb Guest

    RICHARD BROMBERG said the following on 6/23/2007 1:14 PM:
    >
    > Can anyone tell me why I am getting the following VBScript runtime error


    If you can tell anybody what VBScript has to do with Javascript.

    > The actual function is part of an external .JS file. All the other
    > functions work fine.


    What makes you think that VBScript is going to execute in a Javascript File?

    > function fVALIDATEEMAIL("a")
    > {
    > fVALIDATEEMAIL="yes"
    > end function
    > }


    "end function" is invalid JS and as such will throw an error.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Jun 23, 2007
    #2
    1. Advertising

  3. Randy

    I removed the "end function" but the error persists.

    Is it necessary for either the function (or the Dim statement which defines
    the arguement to be passes ) to define a data type ?

    dick
    "Randy Webb" <> wrote in message
    news:...
    > RICHARD BROMBERG said the following on 6/23/2007 1:14 PM:
    >>
    >> Can anyone tell me why I am getting the following VBScript runtime error

    >
    > If you can tell anybody what VBScript has to do with Javascript.
    >
    >> The actual function is part of an external .JS file. All the other
    >> functions work fine.

    >
    > What makes you think that VBScript is going to execute in a Javascript
    > File?
    >
    >> function fVALIDATEEMAIL("a")
    >> {
    >> fVALIDATEEMAIL="yes"
    >> end function
    >> }

    >
    > "end function" is invalid JS and as such will throw an error.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    > Javascript Best Practices -
    > http://www.JavascriptToolbox.com/bestpractices/
    RICHARD BROMBERG, Jun 23, 2007
    #3
  4. RICHARD BROMBERG

    Lee Guest

    RICHARD BROMBERG said:
    >
    >Randy
    >
    >I removed the "end function" but the error persists.
    >
    >Is it necessary for either the function (or the Dim statement which defines
    >the arguement to be passes ) to define a data type ?


    When replying to a post in this newsgroup, please put your
    new text *after* the text you're responding to.

    Are you writing VBScript or Javascript?
    There is no Dim statement in Javascript.

    You should check the resources mentioned in this newsgroup's
    FAQ for tutorials or books from which you might learn some
    basic Javascript syntax.

    The only two lines of:

    >>> function fVALIDATEEMAIL("a")
    >>> {
    >>> fVALIDATEEMAIL="yes"
    >>> end function
    >>> }


    that are reasonable Javascript are the lines that contain only
    curly braces.

    One valid way to write a function named fVALIDATEEMAIL that
    returns the string "yes" would be:

    function fVALIDATEEMAIL()
    {
    return "yes";
    }


    --
    Lee, Jun 23, 2007
    #4
  5. RICHARD BROMBERG

    Randy Webb Guest

    RICHARD BROMBERG said the following on 6/23/2007 5:36 PM:
    > Randy


    Please here top-post don't , upon frowned is it.

    > I removed the "end function" but the error persists.
    >
    > Is it necessary for either the function (or the Dim statement which
    > defines the arguement to be passes ) to define a data type ?


    Why do you think VBScript is going to execute in a JScript block? It
    won't. Try removing the VBScript entirely and see if your error
    persists. If it does, then post a URL to a sample page that shows the
    code and error. My first sentence is a reference to your top posting and
    was done intentionally.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Jun 23, 2007
    #5
  6. What is topposting?
    I am kind of new at this, so please excuse the fact that some of my
    questions sound naive


    I am using JavaScript in an htm..



    "Randy Webb" <> wrote in message
    news:...
    > RICHARD BROMBERG said the following on 6/23/2007 5:36 PM:
    >> Randy

    >
    > Please here top-post don't , upon frowned is it.
    >
    >> I removed the "end function" but the error persists.
    >>
    >> Is it necessary for either the function (or the Dim statement which
    >> defines the arguement to be passes ) to define a data type ?

    >
    > Why do you think VBScript is going to execute in a JScript block? It
    > won't. Try removing the VBScript entirely and see if your error persists.
    > If it does, then post a URL to a sample page that shows the code and
    > error. My first sentence is a reference to your top posting and was done
    > intentionally.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    > Javascript Best Practices -
    > http://www.JavascriptToolbox.com/bestpractices/
    RICHARD BROMBERG, Jun 23, 2007
    #6
  7. Perhaps I should have been a little clearer .

    I am trying to pass a string to the function and inside the function test
    the string and return "yes" or "no" depending on the passed string.


    "Lee" <> wrote in message
    news:...
    > RICHARD BROMBERG said:
    >>
    >>Randy
    >>
    >>I removed the "end function" but the error persists.
    >>
    >>Is it necessary for either the function (or the Dim statement which
    >>defines
    >>the arguement to be passes ) to define a data type ?

    >
    > When replying to a post in this newsgroup, please put your
    > new text *after* the text you're responding to.
    >
    > Are you writing VBScript or Javascript?
    > There is no Dim statement in Javascript.
    >
    > You should check the resources mentioned in this newsgroup's
    > FAQ for tutorials or books from which you might learn some
    > basic Javascript syntax.
    >
    > The only two lines of:
    >
    >>>> function fVALIDATEEMAIL("a")
    >>>> {
    >>>> fVALIDATEEMAIL="yes"
    >>>> end function
    >>>> }

    >
    > that are reasonable Javascript are the lines that contain only
    > curly braces.
    >
    > One valid way to write a function named fVALIDATEEMAIL that
    > returns the string "yes" would be:
    >
    > function fVALIDATEEMAIL()
    > {
    > return "yes";
    > }
    >
    >
    > --
    >
    RICHARD BROMBERG, Jun 24, 2007
    #7
  8. RICHARD BROMBERG

    Lee Guest

    RICHARD BROMBERG said:
    >
    >Perhaps I should have been a little clearer .
    >
    >I am trying to pass a string to the function and inside the function test
    >the string and return "yes" or "no" depending on the passed string.


    Top-posting is when you insist on typing your new text at the
    beginning of the message, instead of after the text you're quoting.

    And, again, you should learn the basics of Javascript before you
    start trying to guess how to write functions.

    function yesOrNo(str) {
    if ( str == "something" ) {
    return "yes";
    } else {
    return "no";
    }
    }

    You do understand the difference between "yes" and true, don't you?


    --
    Lee, Jun 24, 2007
    #8
  9. RICHARD BROMBERG

    -Lost Guest

    RICHARD BROMBERG wrote:
    > "Randy Webb" <> wrote in message
    > news:...
    >> RICHARD BROMBERG said the following on 6/23/2007 5:36 PM:
    >>> Randy

    >>
    >> Please here top-post don't , upon frowned is it.
    >>
    >>> I removed the "end function" but the error persists.
    >>>
    >>> Is it necessary for either the function (or the Dim statement which
    >>> defines the arguement to be passes ) to define a data type ?

    >>
    >> Why do you think VBScript is going to execute in a JScript block? It
    >> won't. Try removing the VBScript entirely and see if your error
    >> persists. If it does, then post a URL to a sample page that shows the
    >> code and error. My first sentence is a reference to your top posting
    >> and was done intentionally.


    <snipped Randy's signature too>

    > What is topposting?
    > I am kind of new at this, so please excuse the fact that some of my
    > questions sound naive


    You don't quote signatures, and you bottom-post (as opposed to top-posting).

    See how I pasted your response to the *bottom*? Then I respond under
    that? It enables everyone to read from the top, down. Instead of
    bottom to the top, or back and forth like most idiots do.

    > I am using JavaScript in an htm..


    Um, you need to reread all of Randy's posts.

    --
    -Lost
    Remove the extra words to reply by e-mail. Don't e-mail me. I am
    kidding. No I am not.
    -Lost, Jun 24, 2007
    #9
    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:
    627
    Karl Seguin
    Aug 10, 2005
  2. type mismatch error

    , Aug 12, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,342
    Kevin Spencer
    Aug 12, 2005
  3. shan

    Type mismatch error

    shan, Nov 20, 2005, in forum: C Programming
    Replies:
    6
    Views:
    649
    Sandeep
    Nov 20, 2005
  4. Murrgon
    Replies:
    1
    Views:
    379
    Thomas Jollans
    Jun 10, 2010
  5. programmingzeal
    Replies:
    0
    Views:
    1,094
    programmingzeal
    May 6, 2012
Loading...

Share This Page