Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docs:programming:javascript:javascript_notes [2007/03/13 17:02] – billh | docs:programming:javascript:javascript_notes [2008/08/03 00:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 32: | Line 32: | ||
* IE uses document.all(" | * IE uses document.all(" | ||
* 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:< | + | * A utility function to get the proper element reference, regardless of browser:< |
function getElem(elemID){ | function getElem(elemID){ | ||
if(document.all){ | if(document.all){ | ||
Line 51: | Line 51: | ||
===== Commenting ===== | ===== Commenting ===== | ||
- | < | + | < |
<SCRIPT language=" | <SCRIPT language=" | ||
Line 70: | Line 70: | ||
</ | </ | ||
+ | ===== Linking to an external script file ===== | ||
+ | <code javascript> | ||
+ | // in the < | ||
+ | <script type=" | ||
+ | </ | ||
+ | ===== Testing for existence of a property or method ===== | ||
+ | <code javascript> | ||
+ | if(elem && typeof elem.property != " | ||
+ | // element property is valid - it is safe to use this property | ||
+ | } | ||
+ | |||
+ | if(elem && typeof elem.method != " | ||
+ | // element method is valid - it is safe to call this method | ||
+ | } | ||
+ | </ |