|
Basic Javascript
Taken from the .Chis Java Studio documentation in the Worfolk Developers
Library.
JavaScript allows you to adding programming functions to your web pages.
Browsers will read the HTML and interpret the JavaScript. JavaScript can
also produce dynamic effects using variables. JavaScript can also react
to events, write HTML code and validate data.
The main parts of javascripts are functions and events. Functions are
mini scripts that can be executed by an event such as a timer or a user
clicking on a link. Take a look at this basic script that brings up a
gray dialog box saying 'Yey! javaScript Rules!'
<script language="JavaScript">
<!--
function yey() {
alert('Yey! JavaScript rules!')
}
// -->
</script>
The java is in a standard script tag (which you will read about next)
and also has <!-- and // -->. This hides
the script from old browsers to prevent area.
|