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(textbox + '.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='txt9360303S'
id='txt9360303S'></td><td><div id='additem' name='additem'
onClick=AddItem('936030/3S')><img src='btnAdd1.jpg' border=0></div></
td></tr></table>
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
} 13 3700
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(textbox + '.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='txt9360303S'
id='txt9360303S'></td><td><div id='additem' name='additem'
onClick=AddItem('936030/3S')><img src='btnAdd1.jpg' border=0></div></
td></tr></table>
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
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.org/>
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.demon.co.uk>
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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(textbox + '.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='txt9360303S'
id='txt9360303S'></td><td><div id='additem' name='additem'
onClick=AddItem('936030/3S')><img src='btnAdd1.jpg' border=0></div></
td></tr></table>
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
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.org/>
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$8300d...@news.demon.co.uk>
So I'm guessing you don't know the answer either...
On Oct 12, 6:28*pm, Stever1975 <Stever1...@gmail.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.
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.javascript FAQ <URL: http://jibbering.com/faq/ >
On Oct 13, 8:28*am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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(textbox + '.value'));
[...]
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
Your markup is not Valid and your script code is atrocious. *Both arehardly
legible. *Once you fixed that, the former using <http://validator.w3.org/>
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 "globalPollution" is an attempt to link the anchor
text to the subject, it fails by being too general. I should be more
like "globalID" or "IDAsGlobalVar" similar. Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalising" ID attribute values.
</FAQENTRY>
--
Rob
On Oct 12, 10:59 pm, RobG <rg...@iinet.net.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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(textbox + '.value'));
[...]
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
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.org/>
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 "globalPollution" is an attempt to link the anchor
text to the subject, it fails by being too general. I should be more
like "globalID" or "IDAsGlobalVar" similar. Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalising" 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
On Oct 13, 3:47*pm, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 10:59 pm, RobG <rg...@iinet.net.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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(textbox + '.value'));
[...]
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item])+
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
Your markup is not Valid and your script code is atrocious. *Bothare hardly
legible. *Once you fixed that, the former using <http://validator..w3.org/>
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 "globalPollution" is an attempt to link the anchor
text to the subject, it fails by being too general. *I should be more
like "globalID" or "IDAsGlobalVar" similar. *Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalising" 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.
On Oct 14, 5:47 am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 10:59 pm, RobG <rg...@iinet.net.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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.org/>
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>
[...]
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
RobG wrote:
On Oct 14, 5:47 am, Stever1975 <Stever1...@gmail.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>
Thomas 'PointedEars' Lahn wrote:
RobG wrote:
>On Oct 14, 5:47 am, Stever1975 <Stever1...@gmail.comwrote:
>
Certainly not Braunschweiger, as I am a vegetarian, but you got the picture :)
Do you eat much soy? http://www.ncbi.nlm.nih.gov/pubmed/15053944
Conclusion:
"The results indicate that long-term consumption of a diet rich in soy
isoflavones can have marked influences on patterns of aggressive and
social behavior."
Soy has some protease inhibitors in it too.
Try and go easy on the soy.
Garrett
>
HTH & HAND
PointedEars
--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
dhtml wrote:
Thomas 'PointedEars' Lahn wrote:
>RobG wrote:
>>On Oct 14, 5:47 am, Stever1975 <Stever1...@gmail.comwrote:
Certainly not Braunschweiger, as I am a vegetarian, but you got the picture :)
Do you eat much soy? [...]
My, my, what a lamer you are.
F'up2 poster
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
On Oct 13, 3:53 pm, dm...@cinsoft.net wrote:
On Oct 13, 3:47 pm, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 10:59 pm, RobG <rg...@iinet.net.auwrote:
On Oct 13, 8:28 am, Stever1975 <Stever1...@gmail.comwrote:
On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.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(textbox + '.value'));
[...]
The Javascript function:
var AddItem=function(Item){
textbox='txt' + Item.replace('/','')
Cart[Item]=parseInt(Cart[Item]==undefined ? 0 : Cart[Item]) +
parseInt(eval(textbox + '.value'));
//DisplayItemQty(Item);
DisplayAllQty(Cart);
//alert(Display(Cart));
}
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.org/>
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 "globalPollution" is an attempt to link the anchor
text to the subject, it fails by being too general. I should be more
like "globalID" or "IDAsGlobalVar" similar. Cluttering the global
space with unneccessary variables is an issue, but it's not limited to
"globalising" 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.
wrote more than a few shopping cart and they were solid, checked by
many eyes far better than mine. Totally different ball game it was all
server side, no javascript or ajax. And I said that the app was
shopping cart 'like' not a shopping cart. Trust me with my current
understanding of javascript I would not be writing an app where money
exchanges hands. I don't think I've gone bonkers or over the top in
any of my responses. And one must always remember that all our past
posts are out there for all to see. And I did admit in my last
response that pointy ears was correct, It's guys like him that will
keep newbies like me on the straight and narrow. Actually since the
post I've been seriously reviewing the FAQ.
Stever1975 wrote:
On Oct 13, 3:53 pm, dm...@cinsoft.net wrote:
>On Oct 13, 3:47 pm, Stever1975 <Stever1...@gmail.comwrote:
>>On Oct 12, 10:59 pm, RobG <rg...@iinet.net.auwrote: On Oct 13, 8:28 am, Stever1975 <Stever1...@gmail.comwrote: On Oct 12, 5:48 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote: >Stever1975 wrote:
And I did admit in my last
response that pointy ears was correct, It's guys like him that will
keep newbies like me on the straight and narrow.
Ears' poor manners do not need any encouragement.
Actually since the
post I've been seriously reviewing the FAQ.
Glad to hear you're reading the FAQ. I'm working on that. If you have
any questions, please post them up.
You might also consider subscribing to
comp.infosystems. www.authoring.stylesheets to learn more about CSS.
--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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()">...
|
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...
|
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....
|
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....
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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...
| | |