>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

AJAX Tutorial Using Drop Down Boxes - page option select function tdtr objrs xmlhttprequest str

 
Registered tutorials: 501
Registered Users: 24390



Rating: 3.44 out of 9 votes cast


  
Category: Technique Introduction

AJAX Tutorial Using Drop Down Boxes

Digg this   Post to del.icio.us

Abstract: Shows how to update a part of the page based on drop down boxed changed values. The demo is also available

The first page contains a simple form and uses the JavaScript "onchange" event for each drop down menu to trigger the function "showResults" from the ajax.js page. The results from the database are updated in the <div> tag at the end of the page.

ยป See the demo

In your default.asp page, place the following in the <head> section:

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

This is a simpe form with three drop down boxes. Each box has an onchange event which passes the values for each box to the showResults function on the ajax.js page. Place the following in the <body> of the default.asp page:

<form name="myform" id="myform">
  <table width="250" border="0">
   <tr><td><strong>age:</strong></td></tr>
   <tr><td>
   <select name="age" onchange="showResults(this.value, document.myform.status.value, document.myform.gender.value)">
    <option value="20">20</option>
    <option value="30">30</option>
    <option value="40">40</option>
   </select></td></tr>
   <tr><td><strong>status:</strong></td></tr>
   <tr><td>
   <select name="status" onchange="showResults(document.myform.age.value, this.value, document.myform.gender.value)">
    <option value="unemployed">unemployed</option>
    <option value="employed">employed</option>
    <option value="student">student</option>
   </select>
   </td></tr>
   <tr><td><strong>gender:</strong></td></tr>
   <tr><td>
   <select name="gender" onchange="showResults(document.myform.age.value, document.myform.status.value, this.value)">
    <option value="male">male</option>
    <option value="female">female</option>
    <option value="any">any</option>
   </select>
   </td></tr>
 </table>
</form>
<div id="txtResults"><p style="font-style:italic">Results will be listed here.</p></div>


Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 2043
Unique Hits: 1664


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0.8 1 4.6 5 18.1 21.8
Current 1 1 4 4 22 26
Previous 1 1 7 10 25 25
Jul 22 2 2 7 8 0 0
Jul 21 0 0 5 5 31 38
Jul 20 0 0 4 4 24 28
Jul 19 1 1 0 0 31 41
Jul 18 0 0 7 7 0 0
Jul 17 0 0 9 9 22 32
Jul 16 1 1 3 3 16 17
Jul 15 2 4 0 0 10 11
Highest 59 76 288 371 1082 1329


Script Execution Time: 16.30027 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2