Michael Jones Javascript

Welcome to Michael Jones web site

Current Location: Home->Tutorials->Javascript

Michael Jones website is a place where you will be able to find out how to achieve a variety of professional special effects and/or functions in web design through the use of my Javascript tutorials and CSS style tutorials, all working with the highest level of accessibility for professional web sites.

There are examples of what special effects you can achieve throughout this site (using browser functions / browser detection, menu styling, latest css (Cascading Style Sheets) styling and other little tricks). If you are after extra code or info on design and accessibility just select the email link above and send Michael jones a request.
 

An introduction of javascript...

...and how you can use it to enhance your website:
pic of a yellow tree / strange pic of michael jones JavaScript is a simple programming code. It was created by Netscape to add functionality to a web page. Some of the simplest functions in javascript can be used for such functionality as roll over images (example to the right). The Code required is as small and simple as follows:

In the html body:
<img src="..." id="mike" onmouseover="switchimage();" />

The javascript code to go in the html head is:
function switchimage()
{
 document.getElementById('mike').src= "../images/newimagename.jpg"
}

Some of the more advanced functions for example mouse locations, menu styling, positioning, browser functions or cookie manipulation, will be looked at throughout this site (code given). However as soon as you pick up the basics you will be rolling, and all will seem alot simpler (as with html, xml, xhtml, css).
 

Michael Jones step by step to javascript:
1. how to include your javascript code/file with your web pages:

Option one: (better if your code will be used on only one page)
Type the following into the head section of your page:

<script type="text/javascript">
your code here
</script>

Option two: (better if your code will be used on more than one page)
Type the following into the head section of all your pages:

<script type="text/javascript" src="html/yourfilename.js"> </script>

Then create all your javascript in a text file and save it as yourfilename.js
 

2. how to label and call your functions:

labeling your functions:
Very simple, type the word function followed by a space and the name of your function and a open an close brackets, open curly brackets to open function and close them at the end. e.g.:

function turnblueintheface()
{
your code here
}

Calling your functions:
if you type into your code section turnblueintheface(); outside of any function then when the document loads the function turnblueintheface will run automatically, alternatively you can drop the same call (turnblueintheface();) into any element call class i.e..

<div onclick="turnblueintheface();">&nbsp</div>
 

3. Inserting notes into your javascript

{
//you can insert notes (lines that will not be executed)
//by preceeding each line of notes with two forward slashes

/* or by enclosing them with a slash and a star (better for multiple lines. This can be particularly useful for testing code as you can temporarily take out sections of code very quickly.) */
}
 

4. Creating and using variables

Variables are temporary places to store data. You can call them whatever you like (apart from a few keywords), and store whatever you like inside them i.e. a piece of text, a number or even an object.

function example()
{
/*To create a variable called bob:*/
var bob;
}
 

Website Design and Hosting by Sakui Web

Javascript Tutorials




Michael Jones rss feed link:


michael jones rss feed

Michael Jones website conforms to the following code and accessibility standards:


Member of W3C Sites dot com
W3C: XHTML 1.0 STRICT COMPLIANT
W3C: CSS COMPLIANT
W3C: CSS COMPLIANT
Level AAA conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0

Michael Jones Alexa Rank: