Adding rows to a table, works in Firefox, but not IE

T

Thomas 'PointedEars' Lahn

Marc said:
But presumably the same logic and coding style could be applied to catch
instances where certain JavaScript will not work due to an older browser
being used?

Only where the problem would not arise because of unsupported syntax elements.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Marc said:
I'll be sure to make that clarification next time, as all of this code
was for a backend interface, of which I have some (though not complete)
control over the browser being used.

However, you should keep in mind that supporting only a particular browser
or a limited set of browsers tends to increase development costs in the
mid-term, from the point on where a vendor decides not to support a
proprietary feature anymore in favor of standards compliance, or decides to
implement it differently, or access is desired from previously unknown Web
user agents (especially portable ones) with a limited/different set of
support (particularly of DOMs).

For example, a large software company I once worked for had their intranet
Web site previously based solely on the MSHTML DOM and that DOM alone,
meaning IE-only. When it was then decided by management that Gecko-based
UAs, particularly Mozilla Firefox, had now achieved great enough a maturity
and market share that they deserved to be supported, it needed to be
rewritten completely. The rewrite and all the development cost required for
that would not have to be spent if programming along Web standards or at
least supporting both the proprietary and the standards compliant approach
through feature detection would have been done in the first place.


PointedEars
 
M

Marc Bradshaw

Marc said:
Hi there, I'm fairly new to JavaScript, coming from a PHP background,
and I am using JavaScript to make the interface nicer on a customer
management system I developed. I'm currently working on the actual page
which allows users to edit a certain customer's details, but I am having
problems getting it to work in IE7.

I've now got another IE-only error which makes no sense. After
developing further and adding two functions to handle deleting contacts
from a customer's file, IE is being difficult again.

When the page loads, I'm getting 6 'expected identifier' errors on
seemingly random lines throughout the script, which haven't changed. I
can see no reason for it at all, nor any pattern in the lines. Google
gave me varying explanations as to what the error means, and so I'm
completely stumped as to where to even start debugging. The script
works completely in Firefox.

Here are the lines causing the error:


countyInput = document.createElement('input');

postcodeInput.name='postcodeText';

postcodeInput.value = self.origPostcode;

leftButtonDiv.appendChild(cancelButton);

var lnameSpan = null;

var self = Contacts;


Any suggestions?

Marc
 
T

Thomas 'PointedEars' Lahn

Marc said:
When the page loads, I'm getting 6 'expected identifier' errors on
seemingly random lines throughout the script, which haven't changed. I
can see no reason for it at all, nor any pattern in the lines. Google
gave me varying explanations as to what the error means, and so I'm
completely stumped as to where to even start debugging. The script
works completely in Firefox.

Here are the lines causing the error [in IE 6]:

Are they even related to each other? Without context, it is almost
impossible to say what might go wrong.
countyInput = document.createElement('input');

postcodeInput.name='postcodeText';

postcodeInput.value = self.origPostcode;

leftButtonDiv.appendChild(cancelButton);

var lnameSpan = null;

var self = Contacts;


Any suggestions?

It seems

1. you are assigning to countyInput but use postcodeInput.
2. you are initializing self after accessing it.

IE script error messages are seldom useful ("error at line 0"). You can
install the Microsoft Script Debugger to debug your scripts:

http://en.wikipedia.org/wiki/Microsoft_Script_Debugger

<FAQENTRY> Martin Honnen recently has also pointed out (in dcljs [1]) that
Visual Studio Express can be downloaded for free from

http://msdn.microsoft.com/vstudio/express/default.aspx

and he deems it viable for debugging of client-side script in IE. </FAQENTRY>


PointedEars
___________
[1] <--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
R

Richard Cornford

Marc Bradshaw wrote:
When the page loads, I'm getting 6 'expected identifier'
errors on seemingly random lines throughout the script,
which haven't changed. I can see no reason for it at
all, nor any pattern in the lines. Google gave me
varying explanations as to what the error means, and so I'm completely
stumped as to where to even start debugging.
The script works completely in Firefox.
<snip>

Verify that IE is actually getting the source text that you think you
are sending it. By clearing the browser's cache using:-

Tools->Internet Options...->General tab->Delete Fiels

Loading the page reporting the errors and while it is displayed going
to:-

Tools->Internet Options...->General tab->Settings...->View Fiels

- finding the file that corresponds with the displayed page and loading
it to a decent text editor. My guess is that you will find some
unexpected noise in what IE is actually receiving. If that is what you
find it is a problem with the encoding of the page, and lies on the
server-side.

Richard.
 
M

Marc Bradshaw

Thomas said:
Here are the lines causing the error [in IE 6]:

Are they even related to each other? Without context, it is almost
impossible to say what might go wrong.

They are all within the same function, except the last one, but are not
related other than the second and third:
1. you are assigning to countyInput but use postcodeInput.

postcodeInput is declared in the same way as countyInput earlier on,
causing no error.
2. you are initializing self after accessing it.

This line is from a different function, there is an identical line
initializing self at the beginning of the function containing the first
five of these lines.
IE script error messages are seldom useful ("error at line 0"). You can
install the Microsoft Script Debugger to debug your scripts:

http://en.wikipedia.org/wiki/Microsoft_Script_Debugger

<FAQENTRY> Martin Honnen recently has also pointed out (in dcljs [1]) that
Visual Studio Express can be downloaded for free from

http://msdn.microsoft.com/vstudio/express/default.aspx

and he deems it viable for debugging of client-side script in IE. </FAQENTRY>

Thank you, I shall investigate these. You are right that IE's script
error messages are all but useful.

Marc
 
M

Marc Bradshaw

Richard said:
Verify that IE is actually getting the source text that you think you
are sending it. By clearing the browser's cache using:-

Tools->Internet Options...->General tab->Delete Fiels

Loading the page reporting the errors and while it is displayed going to:-

Tools->Internet Options...->General tab->Settings...->View Fiels

- finding the file that corresponds with the displayed page and loading
it to a decent text editor. My guess is that you will find some
unexpected noise in what IE is actually receiving. If that is what you
find it is a problem with the encoding of the page, and lies on the
server-side.

I did this, and even refreshed the page twice, but still all that was
showing in the displayed folder was unrelated cookies.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top