JavaScript | Programming | Decisions | Objects
JavaScript is a scripting language for advanced webpage design and interactive features. JavaScript is an object-oriented programming language. A JavaScript file is a plain text file named with a .js extension.
External JavaScript is coded in a separate file with a .js extension. The JavaScript file is called by the XHTML file. The link reference is declared within the header element of the XHTML file. The <script> and </script> tags declare the file type and link reference to the external JavaScript file. The following example calls a JavaScript function with an id name...
Internal JavaScript is coded directly in the XHTML file. Internal JavaScript is coded within the header element of the XHTML file, within the <script> and </script> tags. The CDATA code is not required, but added for cross-browser compatibility. The following example calls a JavaScript function with an id name...
Internal JavaScript can also be coded within the body element of the XHTML file. The following example outputs a value to the browser...
The output to the browser is...
This is a paragraph.
Inline JavaScript is coded directly within the body element of the XHTML file, independent of any other references. The following example outputs an image in a new browser window with defined width and height attributes. Other various window attributes can be defined with a yes or no value...
The output to the browser is...
Click Here
Comments can be added in JavaScript for notes or reminders. Comments are visible in the source code, but not the browser...
The <noscript> and </noscript> tags can be used to declare text as an option for browsers that do not understand JavaScript...