473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textbox id is not defined error for firefox, works fine in IE

I'm working on something similiar to a shopping cart item page. There
is a table of items. Each item has an image, a textbox for the qty
and an image for the add button.
When the add image is clicked it adds the item to the cart array and
sums it if the item already exists in the cart.
This code works perfectly fine in Internet explorer and firefox, heck
I even tested it in chrome and it works.
So everything works fine in all browsers when it's just the table of
items and the javascript code. But when this code is Included into
another page ( the page with menu, footer, and header). It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine...]) +
parseInt(eval(t extbox + '.value'));

(the '...' is because the debugger could not display all the code)
Both pages are in the same directory.

I'm figuring that by including it in another page I'm some how messing
up the DOM. But I can't figure how. So I guess what I'm wondering is
there a particular firefox gotcha that would cause this.


Below is the javascript function I'm using and the html for one of the
items.

<table><tr><td> <input type=text size=2 value=1 name='txt936030 3S'
id='txt9360303S '></td><td><div id='additem' name='additem'
onClick=AddItem ('936030/3S')><img src='btnAdd1.jp g' border=0></div></
td></tr></table>
The Javascript function:

var AddItem=functio n(Item){

textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));

}
Oct 12 '08 #1
13 3716
Stever1975 wrote:
[...] It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine...]) +
parseInt(eval(t extbox + '.value'));

(the '...' is because the debugger could not display all the code)
Both pages are in the same directory.

I'm figuring that by including it in another page I'm some how messing
up the DOM. But I can't figure how. So I guess what I'm wondering is
there a particular firefox gotcha that would cause this.
Highly unlikely.
[...]
Below is the javascript function I'm using and the html for one of the
items.

<table><tr><td> <input type=text size=2 value=1 name='txt936030 3S'
id='txt9360303S '></td><td><div id='additem' name='additem'
onClick=AddItem ('936030/3S')><img src='btnAdd1.jp g' border=0></div></
td></tr></table>
The Javascript function:

var AddItem=functio n(Item){

textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));

}
Your markup is not Valid and your script code is atrocious. Both are hardly
legible. Once you fixed that, the former using <http://validator.w3.or g/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.

Incidentally, FAQ 5.35 should refer to FAQs 5.34 and 5.10 on how to avoid
eval().
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Oct 12 '08 #2
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Stever1975 wrote:
[...] It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine...]) +
parseInt(eval(t extbox + '.value'));
(the '...' is because the debugger could not display all the code)
Both pages are in the same directory.
I'm figuring that by including it in another page I'm some how messing
up the DOM. But I can't figure how. So I guess what I'm wondering is
there a particular firefox gotcha that would cause this.

Highly unlikely.
[...]
Below is the javascript function I'm using and the html for one of the
items.
<table><tr><td> <input type=text size=2 value=1 name='txt936030 3S'
id='txt9360303S '></td><td><div id='additem' name='additem'
onClick=AddItem ('936030/3S')><img src='btnAdd1.jp g' border=0></div></
td></tr></table>
The Javascript function:
var AddItem=functio n(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));
}

Your markup is not Valid and your script code is atrocious. Both are hardly
legible. Once you fixed that, the former using <http://validator.w3.or g/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.

Incidentally, FAQ 5.35 should refer to FAQs 5.34 and 5.10 on how to avoid
eval().

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8 300d...@news.de mon.co.uk>
So I'm guessing you don't know the answer either...
Oct 12 '08 #3
On Oct 12, 6:28*pm, Stever1975 <Stever1...@gma il.comwrote:
>
So I'm guessing you don't know the answer either...
I'm guessing you will ignore the very realistic advice to validate
your markup, read the FAQ about eval, etc.

Good luck with your shopping cart application.
Oct 13 '08 #4
Thomas 'PointedEars' Lahn wrote:
Stever1975 wrote:
>
Incidentally, FAQ 5.35 should refer to FAQs 5.34 and 5.10 on how to avoid
eval().
Duly noted.
>
PointedEars
Garrett

--
comp.lang.javas cript FAQ <URL: http://jibbering.com/faq/ >
Oct 13 '08 #5
On Oct 13, 8:28*am, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Stever1975 wrote:
[...] It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine....]) +
parseInt(eval(t extbox + '.value'));
[...]
The Javascript function:
var AddItem=functio n(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));
}
Your markup is not Valid and your script code is atrocious. *Both arehardly
legible. *Once you fixed that, the former using <http://validator.w3.or g/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.
[...]
>
So I'm guessing you don't know the answer either...
No, he's hoping that when you go to the FAQ to read #5.35 you will
also read the following item, #5.36:

<URL: http://www.jibbering.com/faq/#globalPollution >
<FAQENTRY>

Re: FAQ 5.36

If the anchor name "globalPollutio n" is an attempt to link the anchor
text to the subject, it fails by being too general. I should be more
like "globalID" or "IDAsGlobal Var" similar. Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalisin g" ID attribute values.

</FAQENTRY>
--
Rob
Oct 13 '08 #6
On Oct 12, 10:59 pm, RobG <rg...@iinet.ne t.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Stever1975 wrote:
[...] It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine...]) +
parseInt(eval(t extbox + '.value'));
[...]
The Javascript function:
var AddItem=functio n(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));
}
Your markup is not Valid and your script code is atrocious. Both are hardly
legible. Once you fixed that, the former using <http://validator.w3.or g/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.
[...]
So I'm guessing you don't know the answer either...

No, he's hoping that when you go to the FAQ to read #5.35 you will
also read the following item, #5.36:

<URL:http://www.jibbering.c om/faq/#globalPollutio n>

<FAQENTRY>

Re: FAQ 5.36

If the anchor name "globalPollutio n" is an attempt to link the anchor
text to the subject, it fails by being too general. I should be more
like "globalID" or "IDAsGlobal Var" similar. Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalisin g" ID attribute values.

</FAQENTRY>

--
Rob
Thanks.
Realized what he was saying later on, and he is right Some of us are
newbies and toting out words like 'atrocious' is just not helpful.
How the community reacts in their forums is extremely important to
language growth and acceptance.
thanks again
Oct 13 '08 #7
On Oct 13, 3:47*pm, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 10:59 pm, RobG <rg...@iinet.ne t.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Stever1975 wrote:
[...] It errors out
in firefox with the following error (works fine in other browsers):
txt9360303S is not defined
[Break on this error] Cart[Item]=parseInt(Cart[Item]==undefine...]) +
parseInt(eval(t extbox + '.value'));
[...]
The Javascript function:
var AddItem=functio n(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item])+
parseInt(eval(t extbox + '.value'));
//DisplayItemQty( Item);
DisplayAllQty(C art);
//alert(Display(C art));
}
Your markup is not Valid and your script code is atrocious. *Bothare hardly
legible. *Once you fixed that, the former using <http://validator..w3.o rg/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.
[...]
So I'm guessing you don't know the answer either...
No, he's hoping that when you go to the FAQ to read #5.35 you will
also read the following item, #5.36:
<URL:http://www.jibbering.c om/faq/#globalPollutio n>
<FAQENTRY>
Re: FAQ 5.36
If the anchor name "globalPollutio n" is an attempt to link the anchor
text to the subject, it fails by being too general. *I should be more
like "globalID" or "IDAsGlobal Var" similar. *Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalisin g" ID attribute values.
</FAQENTRY>
--
Rob

Thanks.
Realized what he was saying later on, and he is right Some of us are
newbies and toting out words like 'atrocious' is just not helpful.
Yes it is, when it gets you to pay attention to the points made (e.g.
validate your code, don't use eval.)
How the community reacts in their forums is extremely important to
language growth and acceptance.
How you react to good advice is extremely important to your growth and
acceptance. Your code is atrocious and perhaps you should put off
writing a shopping cart application until you learn the language.
There are enough atrocious scripts out there as it is. Thank you for
your cooperation.
Oct 13 '08 #8
On Oct 14, 5:47 am, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 10:59 pm, RobG <rg...@iinet.ne t.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gma il.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
[...]
Your markup is not Valid and your script code is atrocious. Both are hardly
legible. Once you fixed that, the former using <http://validator.w3.or g/>
and the latter by applying <http://jibbering.com/faq/#evaland other style
guides, you will probably see the problem clear enough by yourself so not to
ask this question again.
[...]
So I'm guessing you don't know the answer either...
No, he's hoping that when you go to the FAQ to read #5.35 you will
also read the following item, #5.36:
<URL:http://www.jibbering.c om/faq/#globalPollutio n>
[...]
Thanks.
Realized what he was saying later on, and he is right Some of us are
newbies and toting out words like 'atrocious' is just not helpful.
How the community reacts in their forums is extremely important to
language growth and acceptance.
Yes. If Thomas’ social skills were even half of his technical skills
he’d probably be a nice bloke. But they ain’t - c'est la vie.

I always imagine his scolding missives being delivered by a portly
grandmother with a wagging finger and a big grin, perhaps the other
hand has a fat slab of toast smeared in braunschweiger. :-)
--
Rob
Oct 13 '08 #9
RobG wrote:
On Oct 14, 5:47 am, Stever1975 <Stever1...@gma il.comwrote:
>Realized what he was saying later on, and he is right Some of us are
newbies and toting out words like 'atrocious' is just not helpful.
How the community reacts in their forums is extremely important to
language growth and acceptance.
And googlodytes with a ridiculous From header like you who know nothing,
don't want to learn anything, and start whining when they are told that this
behavior is not accepted, are lusers that are the last thing the language(s)
need(s). So turn around 180 degrees or go away, silently, please.
Yes. If Thomas’ social skills were even half of his technical skills
he’d probably be a nice bloke. But they ain’t - c'est la vie.
You don't know me.
I always imagine his scolding missives being delivered by a portly
grandmother with a wagging finger and a big grin, perhaps the other
hand has a fat slab of toast smeared in braunschweiger. :-)
Certainly not Braunschweiger, as I am a vegetarian, but you got the picture :)
HTH & HAND

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Oct 13 '08 #10

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

Similar topics

15
5831
by: Johan | last post by:
Hi, I've been working on the following piece of code and it works fine in IE and Opera, dut keep getting the same error in Firefox. Can anyone tell me what's wrong with this code? What I'm trying to do is rewrite the left (navigationframe) and load a page on the right (mainframe). tia, Johan
8
3457
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background is grey. I have a class set as: ..table2Label{ border-style:none; background-color:#F6F6F6; }
3
3906
by: Jon Natwick | last post by:
This "Countdown Timer" code works fine with Ie, but I receive an "Error: Form1 is not defined" error with Firefox 1.0.0 and 1.0.1. <body MS_POSITIONING="FlowLayout" onload="InitializeTimer()"> <form name="Form1" method="post" action="test.aspx" id="Form1"> <script language=JavaScript> var mins, secs, timerID = null, timerRunning = false,...
11
7726
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and the web server performs a database query and displays the results. All of this works fine. I want the user to be able to press the Enter key...
3
12730
by: Joey | last post by:
I have a javascript piece that sets focus to a textbox on one of my webforms. The script works fine for IE: it sets the cursor blinking in the textbox. In Firefox, however, it doesn't work at all. Below are two snippets from the page source as pulled directly out of Firefox after viewing the page: I. HTML CODE BLOCK FOR TEXTBOX
1
1848
by: Chris Lincoln | last post by:
Hello, I can't quite seem to figure out this issue; it is specific to Firefox, as it works fine in IE. I have an iFrame within an aspx page that is passed a value in the query string (e.g. /index.aspx?query=about%20us). What happens (in IE at least!) is that upon load, a textbox is filled with the querystring and a search function is...
0
3483
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table to white the used CSS to set the opacity to 90 so that you can see the background image through the table. The problem I am having is with the...
1
1318
by: mehstg1319 | last post by:
Hi everybody Was wondering if anybody could help. I am a student, developing a couple of pages for my university. I am getting a problem with a javascript Hide/Show that I have put on the page (the vertical links on the left of the grid are the only links i have implemented this on at the moment). The javascript seems to work fine in...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8119
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...
1
7668
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
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
1209
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.