Presentation is loading. Please wait.

Presentation is loading. Please wait.

JavaScript Big fun with JavaScript in the real world

Similar presentations


Presentation on theme: "JavaScript Big fun with JavaScript in the real world"— Presentation transcript:

1 JavaScript Big fun with JavaScript in the real world
Very early in the morning February 17, 2000

2 Why JavaScript? You can’t deal with a Java applet
You want more glitz on your pages You need some active widgets that HTML does not have You want on-the-fly calculations User’s need the option to do database lookups without submitting the HTML form they are filling out

3 Why NOT JavaScript? Some users have turned off JavaScript in their browser Semi-broken implementations Some browsers will never support it You might have to special case the code depending on which browser the user has… With JavaScript, you are signing up for more maintenance and testing costs

4 The basics JavaScript lives in the HTML page surrounded by the tags
<script language="Javascript"> <!-- hide this from lame browsers Your code goes here // --> </script> You get variables, some event handling, and the chance to open new windows without a trip back to the web server

5 Debugging alert("some string") is about as good as it gets
Do yourself a favor and edit the HTML page locally so you are not uploading it to the web server each time you change something while debugging Typing javascript: into the location in Netscape gets you a console

6 Example: Glitz Event handlers let you animate things
<a href="/foo" onMouseOver="funct()" onMouseOut="funct2()"<a> OnClick, OnLoad, OnSubmit, etc. let you attach functions to elements of a page You can change element of the page from the event handler function

7 ...Example: Glitz Javascript functions can stuff values into fields, open windows, or change the images Elements on a page can be addressed like this: document.forms[0].elements.foo.value See

8 Example: Calculations
Running totals are a natural addition to many sorts of forms Unfortunately, JavaScript’s floating point number support is less than optimal See the wretched JAWS timesheet See the well-loved FormsNirvana POT

9 Example: DataBase lookups
Nobody can remember all the job titles or department names at the University You might want to spawn a child window to do a lookup and auto-fill an HTML form field. Example: the conflict of interest form at

10 Summary Do not require the use of JavaScript. Give the JavaScript-challenged equal access to your site Debug carefully. Alert() is your friend. Test on multiple platforms (various browser versions on Unix, Mac, & PC) JavaScript is not harmful when used under controlled conditions


Download ppt "JavaScript Big fun with JavaScript in the real world"

Similar presentations


Ads by Google