Skip to Content
JavaScript Pocket Reference
book

JavaScript Pocket Reference

by David Flanagan
October 1998
Intermediate to advanced
95 pages
4h 36m
English
O'Reilly Media, Inc.
Content preview from JavaScript Pocket Reference
Client-side JavaScript
|
43
function embolden(node) { // Embolden node n
var b = document.createElement("b");
var p = n.parentNode; // Get parent of n
p.replaceChild(b, n); // Replace n with <b>
b.appendChild(n); // Insert n into <b> tag
}
IE 4 DOM
The IE 4 DOM was introduced in Version 4 of Microsoft’s
Internet Explorer browser. It is a powerful but non-standard
DOM with capabilities similar to those of the W3C DOM. IE
5 and later include support for most basic W3C DOM fea-
tures, but this documentation on the IE 4 DOM is included
because IE 4 is still commonly used. The following subsec-
tions document the IE 4 DOM in terms of its differences
from the W3C DOM, so you should be familiar with the
W3C DOM first.
Accessing document elements
The IE 4 DOM does not support the getElementById()
method. Instead, it allows you to look up arbitrary docu-
ment elements by
id attribute within the all[] array of the
document object:
var list = document.all["mylist"];
list = document.all.mylist; // this also works
Instead of supporting the getElementsByTagName() method,
the IE 4 DOM takes the unusual step of defining a
tags()
method on the all[] array, which exists on document ele-
ments as well as the Document object itself. Here’s how to
find all
<li> tags within the first <ul> tag:
var lists = document.all.tags("UL");
var items = lists[0].all.tags("LI");
Note that you must specify the desired HTML tag name in
uppercase ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JavaScript Pocket Reference, 2nd Edition

JavaScript Pocket Reference, 2nd Edition

David Flanagan
Jump Start JavaScript

Jump Start JavaScript

Ara Pehlivanian, Don Nguyen

Publisher Resources

ISBN: 1565925211