By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

Why isn't this working - -help please

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

if (document.This.strOld.value.compareTo(Session("str Password")) != 0)
{ alert("Current password incorrect");
return false;
}

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

Sunshine

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sunshine wrote on 18 jan 2005 in comp.lang.javascript:
if (document.This.strOld.value.compareTo(Session("str Password")) != 0)
{ alert("Current password incorrect");
return false;
}


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

try:
'<%=Session("strPassword")%>'
[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)

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.