docs:programming:javascript:javascript_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:programming:javascript:javascript_notes [2007/03/13 17:02] billhdocs:programming:javascript:javascript_notes [2008/08/03 00:25] (current) – external edit 127.0.0.1
Line 32: Line 32:
   * IE uses document.all("elemID")   * IE uses document.all("elemID")
   * Older Netscape browsers used document.layers[elemID]   * Older Netscape browsers used document.layers[elemID]
-  * A utility function to get the proper element reference, regardless of browser:<code html>+  * A utility function to get the proper element reference, regardless of browser:<code javascript>
 function getElem(elemID){ function getElem(elemID){
  if(document.all){  if(document.all){
Line 51: Line 51:
  
 ===== Commenting ===== ===== Commenting =====
-<code html>+<code javascript>
 <SCRIPT language="JavaScript"> <SCRIPT language="JavaScript">
  
Line 70: Line 70:
 </code> </code>
  
 +===== Linking to an external script file =====
 +<code javascript>
 +// in the <head> section of an html page
 +<script type="JavaScript" src="scriptFilename.js"></script>
 +</code>
  
 +===== Testing for existence of a property or method =====
 +<code javascript>
 +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
 +}
 +</code>
  • docs/programming/javascript/javascript_notes.1173826977.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)