473,594 Members | 2,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(un itslen-1,1).toUpperCas e();
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=Wk Value;
} //---------Qty ASP Checking start
var WkKM = 1;
var WkUnits = "";
var unitslen;
var WkValue = 0;
if ( (Units != "") && (ASP != "" ) ) {
unitslen = Units.length;
TempKM = Units.substr(un itslen-1,1).toUpperCas e();
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=Wk Value;
}

Dec 12 '05 #1
2 2489
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.javas cript 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(un itslen-1,1).toUpperCas e();
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
8253
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8240
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3867
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.