JavaScript is a means of adding dynamic content to your web page without having to have access to the server. Your programs are embedded into your web page and stay there until they reach the client. The client’s web browser than runs the program and displays the dynamic content or does the action on the client’s end.
Always set “Composer Preferences” to “Preserve original source formatting” when using JavaScript. Otherwise, Composer may break your JavaScript into multiple lines, causing it to fail.
- Rolling Images
- Go back to your web page where you created an image and placed it on the web page. Place another image in the same folder. This new image should have the same dimensions as the old one.
- Guided Slide Show
- For this example, you’ll need a bunch of related images all the same size, such as vacation photos. Let’s say you want to display twenty selected images from your last vacation, you would like them to be full-size, but you don’t want to make a really huge web page and you don’t want to make twenty reasonably-sized web pages. We can make a single page that uses JavaScript to switch to a new image when the viewer requests it.
- Viewer Compatibility
- Different browsers can execute JavaScript functionality in different ways. Some viewers will turn off JavaScript for security reasons or to block JavaScript ad pop-ups. You should never rely on JavaScript for essential functionality. It is best used to enhance the viewer’s experience beyond the essential.
- JavaScript Security
- JavaScripts are run on the client. This means that the client has full control over what the scripts do. The client can completely turn off your web page’s ability to run scripts, or it can selectively turn off certain features (such as the ability to pop up new windows or leave cookies).