Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / June 2006



Tip: Looking for answers? Try searching our database.

firefox question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Paal - 27 Jun 2006 18:16 GMT
looking for insight on how to make this javascript solution firefox compatible.

http://www.codeproject.com/useritems/HTMLFixedHeaders.asp

any tips / insight  would be helpful
RobG - 28 Jun 2006 05:54 GMT
> looking for insight on how to make this javascript solution firefox compatible.
>
> http://www.codeproject.com/useritems/HTMLFixedHeaders.asp
>
> any tips / insight  would be helpful

It falls over in Firefox at this line:

 var headerRow = divContent.childNodes[0].childNodes[0].childNodes[0];

Navigating down the dom tree using childNode references is doomed to
fail in most cases, as some browsers (e.g. Firefox) include text nodes
for whitespace that others (e.g. IE) don't.  The required element may
be childNodes[0] in IE but will likely be childNodes[1] in Firefox (and
other Gecko-based browsers).  I'll guess that the expected sequence is:

 divContent -> table -> tbody -> row

If such navigation is necessary, it is better to use:

 var headerRow = divContent.getElementsByTagName('someTag')[0]...

to skip unwanted nodes.  I'll take a punt that in this case:

 var headerRow = divContent.getElementsByTagName('table')[0].rows[0];

or even:

 var headerRow = divContent.getElementsByTagName('tr')[0];

will do the job.  You may need to fix it elsewhere too.

You may want to write a function that gets a particular instance of a
certain childNode type:  getChild(<element>, <nodeName>, <index>) so
you might have something like (pure guesswork here):

 var headerRow = getChild(
                   getChild(divContent, 'table', 0), 'tr', 0);

or

 var headerRow = getChild(divContent, 'table', 0).rows[0];

It is also a good idea in IE too, as someone may introduce a node that
the script isn't expecting.  You could also get the childNodes
collection and skip across the siblings looking for a particular
instance of a certain node type.

There is a script that does a similar thing here (don't expect any help
though):

 <URL:http://www.litotes.demon.co.uk/example_scripts/tableScroll.html>

PS.  Removing any whitespace in the source HTML between tags navigated
using childNodes may fix the issue with no change to the script.

Signature

Rob

Jon Paal - 28 Jun 2006 21:42 GMT
thank you!

I've seen the other, and I know folks here can be real a.sholes about giving any help on it.

>> looking for insight on how to make this javascript solution firefox compatible.
>>
[quoted text clipped - 51 lines]
> PS.  Removing any whitespace in the source HTML between tags navigated
> using childNodes may fix the issue with no change to the script.
RobG - 30 Jun 2006 10:26 GMT
> thank you!
>
> I've seen the other, and I know folks here can be real a.sholes about giving any help on it.

Please don't top post, reply below trimmed quotes.

You won't get help on Richard's example here because he's said that he
published it as an example and doesn't want to provide help in regard to it.

I won't provide help on it because the effort is far beyond what I am
prepared to offer.  It is an interesting example, but I have no
practical use for it.

I think others feel the same, I can't see how that makes us all a bunch
of arseholes.

Signature

Rob

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.