Lesson 8: Status bar message with a click of a button


The main purpose of this lesson is to demonstrate a function. In this script, a function is used in placing a message on status bar using an ordinary button object.

The function, function msg ,is used to call whatever text placed in the property of the button. This call is demonstrated in the followin parts of the code:

input type=button value="Click Here" onClick="msg( ' Can you see it ') "
input type=button value="Over here!" onClick="msg( ' Hi there ' )"

The whole script looks like this:
[script language="JavaScript"]
function msg(msgtext)
{window.status=msgtext}
[/script]
[form]
[input type=button value="Click Here" onClick="msg( ' Can you see it ') "]
[/form]
[form]
[input type=button value="Over Here" onClick="msg( ' Hi there ' )"]
[/form]
[BODY>]

Now lets try how it works

Now lets move on to the next lesson, lesson 9.