The timer runs in milliseconds.
It has been set for two seconds,
because you have already read the content of the hidden element.
In real life, this would be too swift.
(We must be cautious before setting any text to disappear on a timer, because people read at different speeds.)
Let's see the timer at work next . . .
(4) The Page Display
This is the element, and hence its content, that are hidden from view by the CSS and are displayed through the DOM.
The event handler will activate the script function.
The styles in our DOM will replace those in our CSS.
Because DOM and CSS have been developed to work together,
their styles mesh.
So, the replacement should be seamless.
The timer is proper to the browser.
The "BOM" of the major browsers today should fit with the standards as these standards are working together, in mesh
~ ECMA script (javascript standardized) with DOM with CSS with XML/XHTML/HTML.
Syntax
Our DOM code has become a parameter in the BOM timer:
<div><a
href="javascript:void(0);"onclick="showOurExample(); return false">The event handler will activate the scriptfunction.</a> <div id="ourExample">This is the element, and hence its content, that are hidden from view by the CSS and are displayed through the DOM.</div>The styles in our DOM will replace those in our CSS.
Because DOM and CSS have been developed to work together,
their styles mesh.
So, the replacement should be seamless.</div>
Yes, when our hidden element is displayed, it should appear inside our main text now.
The timer has been set for four seconds for you to see this, next . . .
This is the element, and hence its content, that are hidden from view by the CSS and are displayed through the DOM.
The styles in our DOM will replace those in our CSS.
Because DOM and CSS have been developed to work together,
their styles mesh.
So, the replacement should be seamless.
We could insert our hidden element inside almost any other element as long as the nesting is proper.
We've chosen to nest it as a div within another div,
as already shown in the portion of the source, above.
Here is that portion of the source again:
<div><a href="javascript:void(0);" onclick="showOurExample(); return false">
The event handler will activate the script function.</a><div id="ourExample">This is the element, and hence its content, that are hidden from view by the CSS and are displayed through the DOM.</div>The styles in our DOM will replace those in our CSS.
Because DOM and CSS have been developed to work together,
their styles mesh.
So, the replacement should be seamless.</div>
The element's position will be fixed (absolutely) in the document object according to the element's own top and left styles. For instance, we can write an element into the bottom of the document body while we set the element's top and left styles so that it should appear at the top or in the middle or somewhere else, depending on the styles, when the document is displayed on screen.
z-index
The z-index arranges the display, so that an element that is positioned absolute with a higher z-index should appear over, on top of, an element with a lower z-index. Z-index 2 should appear over z-index-1. Z-index 3 should appear over 2, etc.
These additional styles should make our hidden element appear to float when it appears.
Let's see . . .
This is the element, and hence its content, that are hidden from view by the CSS and are displayed through the DOM.
The styles in our DOM will replace those in our CSS.
Because DOM and CSS have been developed to work together,
their styles mesh.
So, the replacement should be seamless.
Yesterday, that could only have been achieved through long, convoluted scripting for cross-browser compatibility.
Today, this can be achieved across the recent browsers with just a few dashes of CSS and a couple of lines of script.
All of this is elementary DOM.
Imagine the possibilities!
Imagine the possibilities!
Imagine the flexibility and creativity even with this elementary DOM.
Imagine the possibilities with images if you happen to be a graphic designer.
My own interest is with text. In this page, I am using nothing more than the methods that have been taught through this lesson.
The exercise here is to indicate (merely to indicate) the possibilities at hand.
Much can be done with these methods alone.
They are available for you already. Yes, they are.
~ And ~
Compatibility and Accessibility
These methods descend gracefully.
Yes, these methods descend gracefully ~ or they ought to ~ for compatibility and accessibility.
They can. This is part of the beauty of DOM and of the coordination of the standards.
Let's finish our lesson very quickly by using our example to glimpse these possibilities.
{
alert("same message here as in our DOM handled element."); }
}
Accessibility: Everything for Everybody
Include a keyboard event handler to complement the mouse event handler, as usual.
Avoid the timer: Use a manual function to close the note.
Think carefully about some noscript content . . .
Noscript Content?
Is noscript content necessary in our example?
Speaking-browsers and text-only browsers usually do not process CSS (or javascript).
A browser that does not process CSS will not hide our element.
So, the text in our hidden element should appear for them.
Oh, oh ~ what about a visitor who might have CSS enabled but javascript disabled?
The text would then be hidden by the CSS.
It would not become visible through the script.
It would be unavailable.
Hmmmmm, what we should do about that? Are you interested in a possible solution?
Write the hidden element ~ its text and its CSS ~ in the DOM part of the script.
Include the alternative, alert message in the ELSE part of the script for earlier browsers.
Make the same message available in the page with noscript content.
Now, the CSS is in the script, and the noscript content is available in the page.
Remember: The same authority that is developing the standards for DOM is also developing the standards for the WAI (Web Accessibility Initiative).
This is the W3C
.
So, through the coordination of standards, it is possible for us to make our material available for everyone at the very same time in the very same page.
Conclusion
Always More to Discover
Well, there is always something more to learn.
There are plenty of possibilities for us to discover.
Just imagine the possibilities.
More at this Threshold
We are just at the threshold.
Much is already possible for us even now.
More will become available for us as we advance.