Web Development HTML Guide - Learn HTML
Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML



Developer Manuals
Learn HTML
Learn PHP
Learn MySQL
Learn CSS
Learn Pear


Developer Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Developer Resources
Developer Tools
Developer News
Developer Forums
Developer Content
Developer Book Reviews
Survey Software

Web Hosting Directory
Budget Web Hosting
ColdFusion Hosting
Dedicated Servers
Domain Hosting
E-Commerce Hosting
Email Hosting
Free Web Hosting
Linux Web Hosting
Managed Hosting
Reseller Hosting
Small Business Hosting
Windows Web Hosting

Attribute for <TEXTAREA ...>
onChange = "script command(s)"

Usage Recommendation
use it, but don't rely on it

onChange is triggered when the user changes the value of the text area. It occurs after the user moves the cursor out of the field, not while the user types. If you want to run a script for every key press you may want to look at onKeyPress.

onChange can be used to modify the value of the text area after the users fills out the field. For example, suppose we want reset the field to completely upper case. First we would put a script like the following into the <HEAD> section of the page:

<SCRIPT TYPE="text/javascript">
<!--
function setupper(myfield)
{
if (myfield.inchange)return;
myfield.inchange=true;
myfield.value=myfield.value.toUpperCase();
myfield.inchange=false;
}
//-->
</SCRIPT>

This script accepts a field object as input, the resets the value of the field to upper case. We can then call the script in the onChange attribute like this:

<TEXTAREA ROWS=10 COLS=20 NAME="IDlist" 
   onChange="setupper(this)"
   ></TEXTAREA>

Notice that the one argument for the script is this, meaning that the field passes itself as the argument. This gives us the following form. Type something into the text area, then click in the next field.

id list:

city:


Copyright Idocs, Inc. Written by Miko Sullivan











About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: