Java Reference
In-Depth Information
Now that you have the tab's number, you pass it to the showDescription() function:
function showDescription(num) {
var descContainer = document.getElementById("descContainer");
The tabs' descriptions are added to the <div/> element with an id of descContainer , so as this code
shows, you first retrieve that element using the getElementById() method.
The descriptions are dynamically created by this function, so now you need to build the description text
and display that text in the descContainer element. First, create a string containing the description for
the tab. In this example, the description is simple and includes the tab's number:
var text = "Description for Tab " + num;
Then add the text to the description element by using its innerHTML property:
descContainer.innerHTML = text;
}
One problem that has plagued the web is the lack of compatibility between the major browsers.
Today's modern browsers do a very good job of implementing the standard DOM, but older browsers,
specifically IE8 and below, only partially support the DOM standard. Despite the lack of support for
the DOM standard in these old browsers, you can still acquire the same useful information on a given
event with old‐IE's event model.
event handling in old versions of internet
explorer
Old‐IE's event model incorporates the use of a global event object (it is a property of the window
object), and one such object exists for each open browser window. The browser updates the event
object every time the user causes an event to occur, and it provides information similar to that of the
standard DOM Event object.
Note To be clear, the information in this section applies to IE8 and below.
We will refer to these old browsers as “old‐IE.” IE9 and later implement the
standard DOM event model. Thankfully, old‐IE's usage continues to dwindle
with each passing year.
accessing the event object
Because the event object is a property of window , it is very simple to access:
<p ondblclick="handle()">Paragraph</p>
<script>
 
 
Search WWH ::




Custom Search