473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Logic Error on Javascript

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. <!--
  3. function ValidatePwd()
  4. valid = true;
  5. var NewP=document.getElementById("NPwd").value;
  6. var OldP=document.getElementById("OPwd").value;
  7. if (NewP.value == OldP.value)
  8. {
  9. alert("Change into new password,please!");
  10. document.getElementById("NPwd").value="";
  11. valid = false;
  12. }
  13. return valid;
  14. }
  15. //-->
  16. </script>
  17. <body>
  18.  
  19. <table border=0 cellspacing=0 cellpadding=0 width=100% height=100%>
  20. <tr align=center valign=top>
  21.  <td>
  22.     <form method=post action=/Intranet/hr/Change_Password_db.asp  id=form1 name=form1 onSubmit="return ValidatePwd();">
  23.      <BR><BR><BR>
  24. ...
  25. ....
  26. .....
  27. <td> <input type="password" maxlength="20" id="NPwd">&nbsp;&nbsp; <input type="submit" value="Submit" id="submit1" name="submit1" style="WIDTH: 80px; HEIGHT: 24px"></td>
  28.  
Help, the javascript always get alert wether it's true or not
Sep 25 '08 #1
4 1825
Friend I really donot undeerstand why you have used this<-- no need second thing "var OldP=document.getElementById("OPwd").value; " from where you are fetching the id OPwd as this is nowhere in your code.Please make everything clear and transparent.
Sep 25 '08 #2
acoder
16,027 Expert Mod 8TB
You should be comparing NewP and OldP, not NewP.value and OldP.value because NewP and OldP are already set to the value!
Sep 26 '08 #3
Hi Hi... got mistake coz long time no longer coding on asp
I have make the correction on OldP and NewP with the thing OldP.value and NewP.value
thanks guys anyway
Oct 9 '08 #4
acoder
16,027 Expert Mod 8TB
So that means it's working now?
Oct 9 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
1
by: robert | last post by:
hi! there's a line in my Javascript program that makes a change in the appearance of an area of the screen. it is a game program, so there are a cascade of changes after the user makes a move....
60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
5
by: GB | last post by:
Okay, here is what I am trying to do We have a dialog of windows that collects information for generation of a dynamic HTML report. The last page in the wizard dialog accepts all report options...
14
by: rabbitrun | last post by:
Hi Everyone, I work for a financial company. I am planning to give a presentation to rest of the development team (15 people) here on moving server side logic to client-side javascript for an...
3
by: pbd22 | last post by:
Hi. I have writting all of my paging logic in javascript. It works pretty fine. Basically, I have created a gridview with full paging in javascript. Now, given a certain need, I am being...
0
by: dbpokorny | last post by:
On Jun 27, 9:09 am, "John Salerno" <johnj...@NOSPAMgmail.comwrote: This is a little anecdote about "separation of presentation, content, and logic." I used to work in a web application...
5
by: sgxbytes | last post by:
Hi, My jsp has a text field company and i have two logic tags with properties years and none. <html:text property="company" onChange="showHint()" /> <logic:equal value="year"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.