Tuesday, October 31, 2006

Javascript

JavaScript
Last week we learned to use javascript to practise interactive website design for use in the project we have been set to create an interactive walkthrough of somewhere that means something to us in Nottingham.

This screenshot shows the selected areas of an image that will be interactive. This is using an image map to create the selected area.

This first piece of javascript code is placed within the head of the website, which runs before any of the rest of the site loads.


I have placed a form with a text box at the bottom of the page which the code will manipulate depending on what the user does. In this quick example the user can either click on Bush or Tony.


Code will then be used to change what happens when the user clicks on Tony or Blair. Here is the code I have used to change what Blair says, using the talkToMe command which was set in the 'head' code.

onmouseout = "talkToMe('')" onmouseover = "talkToMe('Bush Says: Why thank you')

As seen on the next picture, the text box changes to say "Bush Says: Why thank you" when the user points at Bush. The 'onmouseover' function is used for what happens when the user points at the object, and 'onmouseout' for when the user moves away from the object.

No comments: