473,386 Members | 1,823 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,386 software developers and data experts.

javascript

Can someone please help me with an issue I have with Firefox that generates
in the console below when running the code below.Strange thing is that IE
runs it no problem. I don't think it's an async error though as I have seen
some posts.
Martin
Error: fValue has no properties

//---------Qty ASP Checking start
var WkKM = 1;
var WkUnits = "";
var unitslen;
var WkValue = 0;
if ( (Units != "") && (ASP != "" ) ) {
unitslen = Units.length;
TempKM = Units.substr(unitslen-1,1).toUpperCase();
if ( (TempKM== "K" || TempKM == "M") ) {
if (TempKM == "K") {
WkKM = 1000;
}
else if (TempKM == "M") {
WkKM = 1000000;
}
Units = Units.substr(0,unitslen-1);
}

WkUnits = Units* WkKM;

if ( (WkUnits == "") || (IsNumeric(ASP) == false) )
WkValue = 0;
else
WkValue = WkUnits*ASP;
}
if (WkValue <5000)
errmsg = errmsg + "There is a $5000 minimum value for each registration.
\n";
else {
//---------------Insert Value
var fValue=document.getElementById("Value");
fValue.value=WkValue;
} //---------Qty ASP Checking start
var WkKM = 1;
var WkUnits = "";
var unitslen;
var WkValue = 0;
if ( (Units != "") && (ASP != "" ) ) {
unitslen = Units.length;
TempKM = Units.substr(unitslen-1,1).toUpperCase();
if ( (TempKM== "K" || TempKM == "M") ) {
if (TempKM == "K") {
WkKM = 1000;
}
else if (TempKM == "M") {
WkKM = 1000000;
}
Units = Units.substr(0,unitslen-1);
}

WkUnits = Units* WkKM;

if ( (WkUnits == "") || (IsNumeric(ASP) == false) )
WkValue = 0;
else
WkValue = WkUnits*ASP;
}
if (WkValue <5000)
errmsg = errmsg + "There is a $5000 minimum value for each registration.
\n";
else {
//---------------Insert Value
var fValue=document.getElementById("Value");
fValue.value=WkValue;
}

Dec 12 '05 #1
2 2468
martin said the following on 12/12/2005 5:14 AM:
Can someone please help me with an issue I have with Firefox that generates
in the console below when running the code below.Strange thing is that IE
runs it no problem. I don't think it's an async error though as I have seen
some posts.
Martin
Error: fValue has no properties


Without seeing the HTML, first guess is that you have a form field named
"Value" and that the following line:

var fValue=document.getElementById("Value");

In IE, it will incorrectly pick it up by name. Mozilla is not so
forgiving. If it is a form element, then use the forms collection:

var fValue= document.forms['formName'].elements['Value']

Not sure I would name a form field Value though. Too easy to confuse it
with the .value property of form fields.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 12 '05 #2
martin wrote:
Can someone please help me with an issue I have with Firefox that generates
in the console below when running the code below.Strange thing is that IE
runs it no problem. I don't think it's an async error though as I have seen
some posts.
Martin
Error: fValue has no properties

That may be because of the issue Randy has identified, the other (which
you refer to as an 'async error') is that you are running the function
before fValue exists - either the function is run before the document
has finished loading or before some other script that creates fValue has
done its job.

//---------Qty ASP Checking start
var WkKM = 1;
var WkUnits = "";
var unitslen;
var WkValue = 0;
if ( (Units != "") && (ASP != "" ) ) {
unitslen = Units.length;
TempKM = Units.substr(unitslen-1,1).toUpperCase();
The substr() method exists only for backward compatibility with some
older implementations of ECMAScript, it has been removed from the
normative part of Ed 3 (see Appendix B part 2). It may be a good idea
to use the substring method instead, its behaviour is slightly different:

substr(start, length) versus substring(start, end)
If end is lower than start, end & start will be swapped. substring
returns all characters from start up to but not including end. If no
end is specified, then all characters from start to the end of the
string are returned. If no start is specified, zero is used.

You can get rid of the unitslen variable too (I think you are just
trying to strip the last character from Units):

TempKM = Units.substring(Units.length-1).toUpperCase();
if ( (TempKM== "K" || TempKM == "M") ) {
if (TempKM == "K") {
WkKM = 1000;
}
else if (TempKM == "M") {
WkKM = 1000000;
}
Units = Units.substr(0,unitslen-1);


Here you would use:

Units = Units.substring(0,Units.length-1);
Though now the 'Units' variable is actually a number. I think maybe you
should evaluate the names you are giving variables, it isn't good to
mask the true nature of a variable, it can make debugging and
maintenance a pain.
[...]
--
Rob
Dec 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.