<html>
<head>
<title>Javascript Page</title>
<script language="JavaScript" type="text/javascript"><!--
function init(){
alert("Your browser supports scripting!");
}
--></script>
</head>
<body onload="javascript: init();">
<h1>Javascript Page</h1>
<noscript>This will print if the user agent does not support javascript</noscript>
<p>This will always print.</p>
<script language="JavaScript" type="text/javascript"><!--
document.write("You can also run scripts within the body of the page.");
--></script>
</body>
</html>
<SCRIPT language="JavaScript">
<!-- This opens the HTML comments that will hide the script from old browsers
// javascript comment
......Javascript Statements.......
/*
multi-line
javascript
comment
*/
//--> This closes the comment section and the browser will read on normally
</SCRIPT>
// in the <head> section of an html page
<script type="JavaScript" src="scriptFilename.js"></script>
if(elem && typeof elem.property != "undefined"){
// element property is valid - it is safe to use this property
}
if(elem && typeof elem.method != "undefined"){
// element method is valid - it is safe to call this method
}