spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / javascript / domscripting / 1 To page 1current pageTo page 3To page 4To page 5To page 6To page 7
[previous][next]
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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:

http://www.Webreference.com/js/tips/010202.html

In fact if you work through the DOM tips examples at http://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:

home / programming / javascript / domscripting / 1 To page 1current pageTo page 3To page 4To page 5To page 6To page 7
[previous][next]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: August 16, 2001
Revised: August 16, 2001


URL: http://webreference.com/programming/javascript/domscripting/1/2.html