JavaScript, DHTML and AJAX

EHad first AJAXMany types of interaction can be managed through JavaScript or it’s many related technologies. As a tool, JavaScript provides you more fine control than HTML did.  Couple JavaScript with CSS (Dynamic HTML – D-HTML) and you can create effects, do calculations, validate data, and do many other standard operations. Add a data set (Asynchronous JavaScript and XML), and you have something very powerful. While this is not a class in programming, I can provide you with a few essential aspects of the JavaScript language that will get you very far.
First, get familiar with two things:

If you can understand the DOM and you can use getElementById(), you can accomplish plenty.  If you want to check that a user has supplied a value in text box with the ID first value:


var oFirstValue=document.getElementById(”FirstValue”)

if oFirstValue<>””{
//looks fine
}else{
alert(“You did not supply a value”);
}


It is really that simple.  you can also use GetElementByID to change css attributes by appending the style object, as in:


oFirstValue.style.color = “red”;

Events
Events are trapped by the browser on the client side, and they allow you to check specific states.  Here’s a list of events and related handy JavaScript I gave my students years ago. Handy events include onmouseover, onmouseoutm onLoad, onUnload.

Three very commonly used JavaScript libraries are MooTools, Prototype and LightBox. You will find that these two are intergraded in a number of good “AJAX” tools. I also like scriptaculous.

We will implement a few existing JavaScript solutions in class.

You may want to review these lists: