Why isn't this working - -help please

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

    #1

    Why isn't this working - -help please

    Pretty new to javascript so please help. Why isn't this working in my
    validateform()?

    if (document.This. strOld.value.co mpareTo(Session ("strPassword") ) != 0)
    { alert("Current password incorrect");
    return false;
    }

    If I write out Session("strPas sword") the value is 'password'. What am
    I doing wrong?

    Sunshine

  • Evertjan.

    #2
    Re: Why isn't this working - -help please

    Sunshine wrote on 18 jan 2005 in comp.lang.javas cript:
    [color=blue]
    > if (document.This. strOld.value.co mpareTo(Session ("strPassword") ) != 0)
    > { alert("Current password incorrect");
    > return false;
    >}
    >[/color]

    1
    Session is serverside ASP coding and document and alert() are clientside
    coding. The two can never be in the same code.

    try:
    '<%=Session("st rPassword")%>'
    [the outer quoting is necessary to make a string in clientside javascript!]

    2
    compareTo() is not native javascript, and if it were a declared prototype
    function, it would probably return true or false, not 0.


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)

    Comment

    Working...