Re: Script for Hiding/Un-Hiding Text On Click
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Wed, 01 Aug 2007 08:50:11 -0400
Thomas 'PointedEars' Lahn said the following on 8/1/2007 8:06 AM:
David Mark wrote:On Jul 31, 9:30 am, Thomas 'PointedEars' Lahn <PointedE...@xxxxxx> wrote: [snip]
Could you *please* at least try to retain context?
Are you really that stupid? After you complained about context you didn't even restore the full context.
[Context restored]
[full Context restored]
if (document.getElementById) document.write('<style type="text/
css">div.question div {display:none} div.question a
{cursor:pointer;text-decoration:underline;color:blue}</style>');
'<style type="text/ css">div.question div {display:none}
div.question a {cursor:pointer;text-decoration:underline;color:blue}</style>');
2. The above triggers the Netscape Run-Length Bug.
What does? And in what version of Netscape? The later revisions
were tested in at least two versions of Netscape (as well as six
other browsers and a cell phone.)
The NRLB has been spotted in all Netscape 4.x versions. Since it is kind of a heisenbug (not reproducible, probably due to a caching issue), you are not likely to encounter it when you are looking for it. You will, however, encounter it at least once in the script's lifetime. It does exist.
And it won't be encountered by trying to write that style element as NN4.xx series browsers will never execute the document.write statement. Try reading the code again.
The NRLB is (AFAIK) as follows: (At least) Netscape 4.x cannot handle dynamically written code in the `head' element, reason unknown.
Look again and you will note that Netscape4.x series browsers will *never* execute the document.write in question since it is wrapped in an if(document.getElementById) { test and since NN4 doesn't support that feature it will *never* execute it and thus never trigger the NRLB.
Maybe one of the other regulars can explain it in more detail. I had only heard of it in de.comp.lang.javascript, tested it, and saw it confirmed several times. So I avoid to trigger it again, and recommend so. Especially when using style includes that Netscape 4.x does not support makes it unnecessary in the first place:
<link rel="style***" href="!ns4.css" type="text/css"
media="screen">
There is nothing to "explain" as it will never come into play. Perhaps you should go back to de.comp.lang.javascript and have them explain to you why the above code would *not* trigger the NRLB bug in a 10 year old browser.
3. The above is not required as the targeted UAs usually also
support scripting style properties on-load the document, and the
rules are not that complex that they cannot be emulated with
scripting style properties.
I have no idea what that means. But you may wish to keep reading the
thread as the example has been discussed to death and revised five
or six times.
I am talking about the CSS rules that you include with scripting above. That could be facilitated if you simply set the style on each fitting element through interation. However, when I think about it, if NN4 was a target browser, which does not support that approach, the above proposition would be reasonable instead.
You are referring to what has already been covered - along with the pitfalls - of alternative approaches. Had you read and understood the entire thread you would realize that.
[...] window.onload = windowLoad;Needlessly proprietary approach. The (X)HTML body element provides
a standards compliant and well-supported `onload' event handler
attribute:
That line is in the head of the document. The body element doesn't exist at that point.
Non sequitur.
It is very relevant.
<body onload="windowLoad()">
I never use inline event attributes. That was a topic of another recent thread about unobtrusive scripting.
So you are *deliberately* making your code *not interoperable* by insisting on using *proprietary* features where a *well-supported* *standards-compliant* alternative exists? I think that is to be called ignorant incompentence.
What is ignorant incompetence is your belief that you have added anything of value to this thread other than the amusement of people who know better.
BTW, can you name one UA less than 5 years old that does not support window.onload that supports <body onload=? If you can, great. If you can't, then you are just babbling nonsense.
[...]
Don't quote name signatures unless you refer to it, please.
Ummm, yooooohooooo, moron, he asked a specific question about your signature and as such it is the *only* way to "retain context" is by quoting it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- Follow-Ups:
- Re: Script for Hiding/Un-Hiding Text On Click
- From: Thomas 'PointedEars' Lahn
- Re: Script for Hiding/Un-Hiding Text On Click
- References:
- Re: Script for Hiding/Un-Hiding Text On Click
- From: David Mark
- Re: Script for Hiding/Un-Hiding Text On Click
- From: Thomas 'PointedEars' Lahn
- Re: Script for Hiding/Un-Hiding Text On Click
- Prev by Date: Re: Javascript in the address/URL bar
- Next by Date: Re: XMLHttpRequest and Redirects
- Previous by thread: Re: Script for Hiding/Un-Hiding Text On Click
- Next by thread: Re: Script for Hiding/Un-Hiding Text On Click
- Index(es):