473,785 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEle mentById('textA rea');
tA.innerHTML = text;
}

Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascrip t:showText(coac hText)">coach</a>
<a href="javascrip t:showText(main Text)">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 8452
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.getEle mentById('textA rea');
tA.innerHTML = text;
}

Microsoft website says getElementById and innerHTML are supported.

Maybe my function call:

<a href="javascrip t:showText(coac hText)">coach</a>
<a href="javascrip t:showText(main Text)">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.getEle mentById('textA rea');
tA.innerHTML = text;
tA.childNodes[0].nodeValue = text;
or
tA.childNodes[0].data = text;
or
tA.firstChild.n odeValue = text;
or
tA.firstChild.d ata = 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="javascrip t:showText(coac hText)">coach</a>
<a href="javascrip t:showText(main Text)">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.getEle mentById('textA rea');
tA.innerHTML = text;

tA.childNodes[0].nodeValue = text;
or
tA.childNodes[0].data = text;
or
tA.firstChild.n odeValue = text;
or
tA.firstChild.d ata = 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="javascrip t:showText(coac hText)">coach</a>
<a href="javascrip t:showText(main Text)">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
70758
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 = document.getElementById('leftbar').innerHTML; var rb = document.getElementById('rightbar').innerHTML; document.getElementById("myContent").innerHTML = "<span class=\"title_Page\">"+Page+"</span>"; if (zz=="home") { document.getElementById('leftbar').innerHTML = lb;
7
3474
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 original form value not the changed value! Has anyone else encountered this? Cheers.
6
6855
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 build the things I need to but I wondering if it will introduce some new problems that won't surface till I get to testing. Andrew Poulos
4
6553
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 createElement methods, then added a bit of extra text using innerHTML, only to find most of the attributes removed from the table. Below is a script that calls the same code to add a table inside a div. It adds an onclick to the div and...
9
8671
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 <http://www.jibbering.com/faq/faq_notes/alt_dynwrite.html> need such a lot of tests to find out if innerHTML assignment actually works, instead of just inserting <span id="strange name"></span> and checking if the document now contains an element with that ID?
2
9566
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 input boxes. I then take the innerHTML from my <div> and add the new table to the existing one/s. What happens in FireFox is that all values in other tables input boxes
17
34724
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 fine. However the HTML have a SCRIPT tag that the browser should process, but
9
3399
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 = dt.innerHTML + 'new' in Firefox, I get "test textnew"
6
4256
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 exactly matches the contents of the div with one exception. It seems that whenever the code includes a tag which uses the forward slash against the closing bracket (say the break tag ..... />) that the browser, or HTML, or javascript, or...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.