/    Sign up×
Community /Pin to ProfileBookmark

Javascript Firefox vs. IE

Can anyone please tell me why the following code does not work in IE. We are developing an online store and this code displays a price and quantity table from our database.

Getting the data is no problem. But displaying it the way we need is a problem.

[CODE]
// if not a standard item then only show above minimum prices
// get the string from the current row – qty column
str = tableInfo[y].quantity;

// rip only the first number in that string
str = str.substring(0, temp);

// change that string to an integer
number = parseInt(str);
// display price chart with minimum quantities
// use the new integer
if(number > minimum || number == minimum)
{
// build and display table
}
[/CODE]

This code grabs the current row of 2 columns, price and quantity. Then converts the qty into an integer so I can create a conditional lower in code. This works great in Firefox but I just learned that it does not work in IE7. Any thoughts?

Thank you,
Scott

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@DokJul 30.2007 — What does the error tell us?
Copy linkTweet thisAlerts:
@erse_scottauthorJul 30.2007 — Unfortunately, the error doesn't tell us anything. I am parsing from an existing table and displaying it in my format. When I added this code it skips my format and displays the original table again. It is encountering an error and just stopping in mid run so the original table remains.

Is there any other information that might be helpful?

Thanks,

Scott
Copy linkTweet thisAlerts:
@DokJul 30.2007 — If you are accessing a text node to get the value of quantity that might be the problem - IE has a different idea about what constitutes a text node than other browsers.

Check that all your variables is what you think they should be.
Copy linkTweet thisAlerts:
@erse_scottauthorJul 30.2007 — The data I am accessing is a string. I am ripping it and then converting it to an integer in order to display the price table correctly. Is this the problem? If so do you know how I might fix?

Thank you very much,

Scott
Copy linkTweet thisAlerts:
@DokJul 30.2007 — No the approach is good but are you sure that you're setting the variable quantity to the right value in IE?

What does tableInfo[y].quantity reference? A text node, an input tag, a table cell ?
Copy linkTweet thisAlerts:
@erse_scottauthorJul 30.2007 — tableInfo[y].quantity points to a table cell. The value is usually "1 - 9" or "25 - 49" or something similar. I am ripping the first number (1 or 25 in these cases, omitting 9 and 49) and using that to build another table.

If tableInfo[y].quantity pointed to a text node, how should I handle it? Maybe I am wrong about the string. But it works fine if I take out the code I used above.
Copy linkTweet thisAlerts:
@DokJul 30.2007 — Post the an URL for a example or the entire script/HTML here if you don't have access to a webserver.
Copy linkTweet thisAlerts:
@erse_scottauthorJul 31.2007 — Dok,

Thanks for all your help yesterday. I would like to send you a private message with a URL to our site. I am not comfortable posting a URL yet because we have a current customer base and I do not want anything leaked to our new site. Can you turn on private messaging really quick and I send you a link?

Thanks,

Scott
Copy linkTweet thisAlerts:
@erse_scottauthorJul 31.2007 — I found a fix for this problem. I changed my logic to the below code. It works great in both IE and Firefox. And it is much simpler. Thanks for your help Dok! ?
[CODE]
// find the first number of each quantity level
number = parseInt(tableInfo[y].quantity);
[/CODE]
×

Success!

Help @erse_scott spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...