This is a discussion on "Problem for good specialist - variable changing by itself." within the JavaScript Forum section. This forum, and the thread "Problem for good specialist - variable changing by itself. are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Problem for good specialist - variable changing by itself.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Problem for good specialist - variable changing by itself.
Hello Javascript specialists,
I'm trying to build a website with a register page, and validating the fields with javascript. This validation is being done every time you go out of an input element, as well as before the form is being submitted. To do the verification I use a global variable "errors" which is false if there are no errors found, and true if there are errors found. It works great on Mozilla & Opera, but when I tested it on I.E. 6.0 (on windows XP) it behaved very strangly... After a while I found out that the variable "errors" wasn't correct, and when I used alert(errors); , I've noticed that the value shown to me was false (-->no errors), but the behavior was good because it was true (--> errors, do not submit). Then doing alert(errors); alert(errors); directly after each other first gave me false, and then true!? To see what I'm talking about I made my code a lot shorter (containing the same problem), and attached that here:
I think it might be an error in Jscript (the javascript engine of I.E.) and more specifically, something with their garbage collector, although I might be completely wrong. If you've tried this, get the same error, and aren't using I.E. 6, please let me know what browser (and version) gave the same error. If you've found a way to get the correct value into varable "errors" without having to use the alert() method, please tell me. I really need some help with this one. |
|
|
|
#2
|
|||
|
|||
|
Re: Problem for good specialist - variable changing by itself.
Can you post a working example. the code above has missing parenthesis and misspelled parameters. I'm not even sure what the intent of this line is, so it's hard to help.
removeChild(HTMLInputElement.parentNod e.parentNode.nextSibling) |
|
#3
|
|||
|
|||
|
Re: Problem for good specialist - variable changing by itself.
It's okay, I've found my error. In IE the onblur event is triggered to late. So the solution is to not activate the code by using the onblur trigger, but instead activating it by directly executing the code, without activating the onBlur with focus() on every element
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing a session variable when clicking a link? | Crow555 | Classic ASP | 0 | May 15th, 2008 12:22 |
| Variable problem | trylah | JavaScript Forum | 0 | Apr 11th, 2007 08:22 |
| Another Variable problem | VanderBOOM | JavaScript Forum | 2 | Nov 16th, 2006 17:25 |
| problem with Session variable | andrew_perez5 | Classic ASP | 0 | Jan 24th, 2005 03:42 |
| Help changing the WHERE Variable? | courtjester | Databases | 5 | Jun 2nd, 2004 15:35 |