JavaScript+Animations

= JavaScript Animations =

toc How javascript slideshows and other image animations might affect the LIS profession
LIS facilities may want to consider using javascript-enabled animations in order to engage patrons and present a visually attractive web presence. Archives, museums, and other repositories sharing some of their collections, may be interested in providing a slideshow of representative items, while libraries might want to promote books to support a given event, such as Martin Luther King, Jr., day, or Christmas. Drop-down and cascading menus can help to neatly organize a site that threatens to have too many links. Understanding the various possibilities available through javascript programs will allow maximum user engagement and interaction while providing a professional look and feel to the website.

Brief history
JavaScript was developed by Netscape under the original name, "Mocha," then "LiveScript," in 1995, and released with Netscape 2.0. It went on to become the internet standard for object manipulation and content modification, though it is not supported in all browsers. Some of the more obvious examples of JavaScript on a webpage are color-changing backgrounds and objects trailing after a visitor's cursor. JavaScript also allows a site to cycle photographs or other graphic images in slideshow-type presentations or to immediately link to a larger picture from a thumbnail through a pop-up. Less noticeable applications of JavaScript can check to see if cookies are enabled on a site visitor's browser, or, to inform a returning visitor of new additions to a page.

Using JavaScript
Javascript is best used as a client-side program which works through the site visitor's browser rather than through the host site's server. This allows a site to be more dynamic with time and date functions and user interactions. JavaScript run from a server is slower and less dependable and does nothing that could not be done from the client's side of the interaction.

JavaScript code can be inserted into an HTML document, which is convenient for testing a script, or for a single-use application on a site; or, it can be coded onto a separate document with a *.js suffix. In general, if a script writer is not testing script, it is considered better to have the JavaScript coding on a separate document. This allows the script to function on more than one page, or, to be used on more than one site. To insert a JavaScript into an HTML document, place the actual scripting code in the "HEAD" section, then place the code which implements the script into the "BODY" section where the application is meant to be. To implement an off-page JavaScript document, *.js, create the JavaScript document, then link to it in the "HEAD" section of the HTML document using HTML linking code. JavaScript can also have a component on an outside *.css, Cascading Style Sheet, document. Because of its name, Javascript is often confused with the Java programming language. There is some similarity in syntax, but, the two are not the same thing. Javascript is still not supported across all platforms, while Java is cross-platform. The two share syntax, the idea of objects and classes, and math and string libraries but little else. There are on-line sites which offer free use of Javascript codes for websites. Some may offer tutorials on Javascript, Ajax, HTML, and other site-building codes. The codes themselves contain the name of the creator, and the name of the offering site, along with a link back to it.

Examples
JavaScript allows animation by manipulating objects on a page. Slide-shows, pop-up text or image boxes for shorter pages, animated slide navigation bars for sites with many pages or links, cascading menus, collapsible menus, fade effects on rollovers, glide-in boxes, highlighted links on mouse-overs, and color-changing backgrounds and cursor-chasing gifs. JavaScript and HTML work in a partnership to enhance a visitor's experience. Create a JavaScript document, with the .js extension and create the parameters of the script: Enter the linking code into the body of the HTML document where you would like it to be displayed: If the script does not work, check the coding. Commas instead of periods, square brackets instead of curly brackets, forgotten punctuation, can all stop a script from running.

**References**
O'Reilly: [|JavaScript: How Did We Get Here?]

[|JavaScript Data Types]

[|JavaScript Source]