?
Solved

setting a property that has only a getter

Posted on 2008-10-06
5
Medium Priority
?
870 Views
Last Modified: 2012-05-05
I get the subject error message in FireFox error console.

I believe line 46 is either
ename = document.st.elements[i].name;
or
f2 = ename.substr(0,2);

What does this mean? I don't see a problem.


le = document.st.elements.length;	
			someok = false;
			for (i = 0; i < le; i++) {
				if (document.st.elements[i].type = "hidden") {
					ename = document.st.elements[i].name;
					f2 = ename.substr(0,2);
					if (f2 == "lu") {
						if (document.st.elements[i].value != "None") {
							luval = parseInt(document.st.elements[i].value);
							unitval = parseInt(document.st.selall.value);
							if (luval >= unitval) {
								someok = true;
								break;
							}
						}
					}
				}
			}

Open in new window

0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 22653052
make sure your form tag has name="st" AND also make sure every input element has a name defined. If one of your fields does not have a name, this:
ename = document.st.elements[i].name;

will set ename to undefined and cause problems.
0
 

Author Comment

by:Richard Korts
ID: 22653232
To hielo:

I gave names to all the elements, including the submit buttons. They were the only ones with no name.

It does the same thing.

Entire html file is attached (note the html is generated from php).
htmlsource.txt
0
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22653829
>>if (document.st.elements[i].type = "hidden")
you nee TWO equal signs:
if (document.st.elements[i].type == "hidden")
0
 

Author Closing Comment

by:Richard Korts
ID: 31503544
That one gets me EVERY time, in both php & JavaScript. For some reason, I can NEVER see those. So obvious, but so illusive.
0
 
LVL 82

Expert Comment

by:hielo
ID: 22654269
>>That one gets me EVERY time
Then it's your responsibility to learn from your mistakes. If you always get something like this wrong:
if( x = 3 )

you will NEVER get it wrong if you invert them:
if( 3 = x )

a number and a string are "constants". You cannot assign something to a constant, so the compiler/interpreter will throw a runtime error if you omit that second = sign. At that point its obvious.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question