spacer
Yehuda Shiran January 27, 2000
Hiding New Features
Tips: January 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
When a new JavaScript version is released, new features are introduced with it. When using these features, you have to hide them from older versions of JavaScript. The cumbersome way is to remember which browser versions were released with the new JavaScript version, and to hide the new features from older versions of these browsers. It is much simpler just to specify the new JavaScript version in the <SCRIPT> tag. Only JavaScript engines matching this version will interpret the code. Older versions of JavaScript engines will just ignore this tag, and will not interpret the JavaScript section. The following JavaScript code will be processed only by JavaScript engines of 1.3 and up:

<SCRIPT LANGUAGE="JavaScript1.3">
<!--
 function handleClick() {
   alert("This browser supports JavaScript 1.3 and up");
}
document.write('<FORM NAME="jukebox">Hit the button:<INPUT TYPE="button" ID="display" VALUE="Demo 1.3" onclick="handleClick()">');
// -->
</SCRIPT>

You should see a Demo button here:

If you don't see the button, your browser does not support JavaScript 1.3. The following code will be exercised only when JavaScript 1.4 comes along:

<SCRIPT LANGUAGE="JavaScript1.4">
<!--
 function handleClick() {
   alert("This browser supports JavaScript 1.4 and up");
}
document.write('<FORM NAME="jukebox">Hit the button:<INPUT TYPE="button" ID="display" VALUE="Demo 1.4" onclick="handleClick()">');
// -->
</SCRIPT>

You should see a Demo button here when JavaScript 1.4 is out:

Many features have been introduced in JavaScript 1.3. Learn more about them in Column 25, JavaScript 1.3 Overview, Part I, and Column 26, JavaScript 1.3 Overview, Part II.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags