Scripting for 5th Generation Browsers and Beyond - Part I - (2/7)
[previous][next] |
Scripting for 5th Generation Browsers and Beyond
What Is A Standard Anyway?
I have already mentioned coding by W3C standards, but what makes more sense to me is that the standard that matters most is what is currently supported by both browsers without having to rely on proprietary methods and consequently conditional branches. That is not to say I am not an advocate of W3C standards, because the reality is I believe in this fundamental concept and support it as much as possible.
However, I am constantly drawn back to the practical as opposed to strictly coding
by W3C methods, particularly when both browsers have the same implementation for a method. For
example innerHTML
which is not a W3C recommendation is supported by both Netscape 6
and Internet Explorer, so to me it makes sense to take advantage of this powerful technique. For
example: (live example)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Write Content to Layer</title>
<script>
<!--
function writetoLyr(name, message) {
document.getElementById(name).innerHTML = message;
}
//-->
</script>
</head>
<body>
<a href="javascript:writetoLyr('contentLayer',
'<p>Eddie Was Here </p>')">
Write Something to the Layer
</a>
<div id="contentLayer"
STYLE="position: absolute; left: 400px; top: 300px;
width: 370px; height: 0px; z-index: 6;
visibility: visible border: none ">
</div>
</body>
</html>
For all intents and purposes the standard that matters most is what is common
to both browsers. At least that is how I typically approach things; to find the common denominator
for both browsers. In many ways, the future looks a lot brighter as more DOM related methods get
implemented into browsers. For example, Internet Explorer 6 now supports the replaceData()
method which is handy for manipulating text strings. Try this Doc JavaScript tip in Internet Explorer 6:
https://www.Webreference.com/js/tips/010202.html
In fact if you work through the DOM tips examples at https://www.Webreference.com/js/tips/ you will find that quite a few things that were not working in Internet Explorer 5 and 5.5 now work with Internet Explorer 6. The point being that common standards between browsers are frequently being updated and it's a developer's "duty" to keep a keen eye on the changes that are occurring. Thus it is not just the W3C we need to keep an eye on for new recommendations, but also what the new browsers have in common that fall outside of the W3C recommendations realm. Both are equally important.
For the moment though we need to focus on the here and now, so let us begin by taking a look at how to retrieve elements.
Contents:
- Code Reduction
- What Is A Standard Anyway?
- Retrieving Elements
- Rollover Fun with
setAttribute()
- Four State DOM Rollovers with a Single Image
- Creating Elements
- CSS Dynamic Manipulation
[previous][next] |
Created: August 16, 2001
Revised: August 16, 2001