Hindi Songs

Search About PHP!!!

Thursday, July 9, 2009

Example explained - The HTML page

The HTML page contains a link to an external JavaScript, an HTML form, and a div element:

<>
<>
< type="text/javascript" src="selectuser.js">< /script >
< /head >
<>

<>
Select a User:
< name="users" onchange="showUser(this.value)">
< value="1">Peter Griffin< /option >
< value="2">Lois Griffin< /option >
< value="3">Glenn Quagmire< /option >

< /select >
< /form >
<>
< id="txtHint"><>Person info will be listed here.< /b >< /div >

< /body >
< /html >

As you can see it is just a simple HTML form with a drop down box called "customers".

The

below the form will be used as a placeholder for info retrieved from the web server.

When the user selects data, a function called "showUser()" is executed. The execution of the function is triggered by the "onchange" event. In other words: Each time the user change the value in the drop down box, the function showUser() is called.