473,408 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

innerHTML / IE6 /NN7

Hello again

Site I'm working on: http://www3.telus.net/bikim/lightning/test/

- 'coach' & 'main' links swap innerHTML of div element - id 'textArea'

works fine in NN7; IE6 reports 'Object doesn't support this property or method'

code is:

function showText(text)
{
var tA = document.getElementById('textArea');
tA.innerHTML = text;
}

Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascript:showText(coachText)">coach</a>
<a href="javascript:showText(mainText)">main</a>

Thanks

--
Phil Newcombe - philn?telus?net
http://www3.telus.net/bikim

Netscape/Gecko/Mozilla - standards conformance and cooperation
Internet Explorer - standards obfuscation and divergence
Linux += 30,000/Germany + 80,000/Spain + tomorrow

Jul 20 '05 #1
5 8425
Scripsit "Phil N":
Hello again

Site I'm working on: http://www3.telus.net/bikim/lightning/test/

- 'coach' & 'main' links swap innerHTML of div element - id 'textArea'

works fine in NN7; IE6 reports 'Object doesn't support this property or
method'

code is:

function showText(text)
{
var tA = document.getElementById('textArea');
tA.innerHTML = text;
}

Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascript:showText(coachText)">coach</a>
<a href="javascript:showText(mainText)">main</a>

Thanks

You should use an IFrame, it'll be much more accessible and easy to
maintain than Javascript code (and some people disable javascript to
avoid popups...).

But the javascript works fine for me, no errors (IE6 and Mozilla 1.4).

Jul 20 '05 #2
yzzzzz wrote:
You should use an IFrame, it'll be much more accessible and easy to
maintain than Javascript code (and some people disable javascript to
avoid popups...).

But the javascript works fine for me, no errors (IE6 and Mozilla 1.4).


Thanks - I'll look at IFrames. Maybe because I don't have the service packs
installed? My box went berserk last time I tried that and I had to do a
pcrestore thing from the W98 cd to get it back.

--
Phil Newcombe - philn?telus?net
http://www3.telus.net/bikim

Netscape/Gecko/Mozilla - standards conformance and cooperation
Internet Explorer - standards obfuscation and divergence
Linux += 30,000/Germany + 80,000/Spain + tomorrow

Jul 20 '05 #3
DU
Phil N wrote:
Hello again

Site I'm working on: http://www3.telus.net/bikim/lightning/test/

- 'coach' & 'main' links swap innerHTML of div element - id 'textArea'

works fine in NN7; IE6 reports 'Object doesn't support this property or
method'

code is:

function showText(text)
{
var tA = document.getElementById('textArea');
tA.innerHTML = text;
tA.childNodes[0].nodeValue = text;
or
tA.childNodes[0].data = text;
or
tA.firstChild.nodeValue = text;
or
tA.firstChild.data = text;
will all work faster (from 300% to 2000%) than resorting to non W3C web
standard innerHTML.
}
If the text parameter is a string, then there is no need to resort to
innerHTML. Just use valid W3C DOM 1 characterData data property or
nodeValue for such text node.

Performance comparison between innerHTML method and DOM's nodeValue when
changing, modifying the text data of a node of type TEXT_NODE
http://www10.brinkster.com/doctorunc...NodeValue.html
W3C DOM 1 CharacterData methods and properties are perfectly supported
by recent versions of major browser manufacturers and other W3C DOM 1
compliant browsers.

DOM level 1 CharacterData Interface attributes and methods tests
http://www10.brinkster.com/doctorunc...acterData.html
Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascript:showText(coachText)">coach</a>
<a href="javascript:showText(mainText)">main</a>

Thanks


It is widely known and almost universally recognized that resorting to
"javascript:" pseudo-protocol in href attribute is wrong, bad and bound
to create problems unless you're creating a bookmarklet.

http://jibbering.com/faq/#FAQ4_24

Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links
"A link should be a simple hypertext reference that replaces the current
page with new content. (...) of course (...) link is not a piece of code
that interferes with the browser’s standard behavior."
http://www.useit.com/alertbox/20021223.html

"Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the link. If
you want to use JavaScript for browsers that have JavaScript enabled,
use the onMouseOver and onClick attributes of the <a href> tag."
http://www.rahul.net/aahz/javascript.html#remove

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #4
DU
DU wrote:
Phil N wrote:
Hello again

Site I'm working on: http://www3.telus.net/bikim/lightning/test/

- 'coach' & 'main' links swap innerHTML of div element - id 'textArea'

works fine in NN7; IE6 reports 'Object doesn't support this property
or method'

code is:

function showText(text)
{
var tA = document.getElementById('textArea');
tA.innerHTML = text;

tA.childNodes[0].nodeValue = text;
or
tA.childNodes[0].data = text;
or
tA.firstChild.nodeValue = text;
or
tA.firstChild.data = text;
will all work faster (from 300% to 2000%) than resorting to non W3C web
standard innerHTML.
}

If the text parameter is a string, then there is no need to resort to
innerHTML. Just use valid W3C DOM 1 characterData data property or
nodeValue for such text node.

Performance comparison between innerHTML method and DOM's nodeValue when
changing, modifying the text data of a node of type TEXT_NODE
http://www10.brinkster.com/doctorunc...NodeValue.html

W3C DOM 1 CharacterData methods and properties are perfectly supported
by recent versions of major browser manufacturers and other W3C DOM 1
compliant browsers.

DOM level 1 CharacterData Interface attributes and methods tests
http://www10.brinkster.com/doctorunc...acterData.html

Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascript:showText(coachText)">coach</a>
<a href="javascript:showText(mainText)">main</a>

Thanks


It is widely known and almost universally recognized that resorting to
"javascript:" pseudo-protocol in href attribute is wrong, bad and bound
to create problems unless you're creating a bookmarklet.

http://jibbering.com/faq/#FAQ4_24

Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links
"A link should be a simple hypertext reference that replaces the current
page with new content. (...) of course (...) link is not a piece of code
that interferes with the browser’s standard behavior."
http://www.useit.com/alertbox/20021223.html

"Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the link. If
you want to use JavaScript for browsers that have JavaScript enabled,
use the onMouseOver and onClick attributes of the <a href> tag."
http://www.rahul.net/aahz/javascript.html#remove

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/


Please ignore the innerHTML vs nodeValue reference here. Your parameter
identifiers (function names, parameters, id values) are extremely
confusing. You're not passing a real TEXT_NODE to your displayText and
showText functions but markup value first converted as string to be
processed as new html nodes.

I would do things quite differently if I were you. Just a <div></div>
with display:none and with the ability to modify its text node only.
Maybe there would be more faster, efficient way to do all this... if we
knew your webpage situation, context more.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #5
DU wrote:
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

-- Not sure if this will appear in the right order in the thread as my ISP seems
to be delaying some of my posts/emails lately. So this should be after my last
one. --

Sorry, forgot to mention I'm not using toggleText() _or_ displayText() here.

I've changed tA.innerHTML = text;

to
tA.childNodes[0].nodeValue = text;


as you suggested but it doesn't do what I want - it just displays the raw ascii
text. I'm sure you understand that but I want to display the actual rendered
page.

(I wonder if learning JS/DOM/CSS+browser inconsistencies/bugs+xml/xhtml/ad
nauseum. is more confusing than calculus?)
--
Phil Newcombe - philn?telus?net
http://www3.telus.net/bikim

Netscape/Gecko/Mozilla - standards conformance and cooperation
Internet Explorer - standards obfuscation and divergence
Linux += 30,000/Germany + 80,000/Spain + tomorrow

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
How can I get the innerHTML of a <div> area only when the page loads, then use that variable in a function? Here is my code: function setContent(zz) { var lb =...
7
by: KK | last post by:
Please help! I am currently experiencing a bug in Safari v125.9. When I modify the value of form input box and then get the innerHTML property of the surrounding div object - I am returned the...
6
by: Andrew Poulos | last post by:
Given that I need to be able to add a TYPE attribute when I'm using createElement and it seems to fail in both IE and FF (but not MZ) is it 'safer' to use innerHTML instead? I can dynamically...
4
by: RobG | last post by:
I know you aren't supposed to use innerHTML to mess with table structure, but it seems you can't use it just after a table without damaging the containing element. I added a table to a div using...
9
by: Hallvard B Furuseth | last post by:
Why does the FAQ (Q 4.15) recommend innerHTML when so many here say one should use createElement(), replaceChild() etc? Also, why does the "Alternative DynWrite function" at...
2
by: sveinn | last post by:
Hi all, I've read through this group searching for an answear about this problem. Few have come close but not quite what I need. My problem is this: I'm using Ajax to fetch a new table with...
17
by: PJ | last post by:
Greetings... I have stumbled upon a small problem. I use Ajax to retrieve part of a page I need to update. I update a DIV element with the HTML contents I get from another page. It works...
9
by: martymix | last post by:
simple question: I have a simple <dt>test text</dt> I get the innerHTML of that dt, and I try and append some text to it like so: dt = document.getElementsByTagName('dt') var text =...
6
by: PaPa | last post by:
I'm not sure this is a javascript issue or an HTML issue. I notice that when I extract the contents of a div using the innerHTML property (?), that I wind up with a literal variable (?) which...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.