[Javascript] Re: how big can a text box be
Roger Roelofs
rer at datacompusa.com
Wed Mar 20 07:17:53 CST 2002
Scott,
I'm glad you figured out the 255 char limit problem you were having.
While you're at it you can make this code more efficient by combining
the loops. Check out the suggested changes I've made to your code.
On Wednesday, March 20, 2002, at 12:41 AM, javascript-
request at LaTech.edu wrote:
> //=======================================================================
> ===
> //=======================================================================
> ===
> //=Loop through the start array and then compare it against the end
> array
> //=======================================================================
> ===
> //=======================================================================
> ===
> function WhatHasChanged()
> {
>
> var logline ='';
var elemType = '';
> endvals = new Array(); //data from db
> //=============================================
> // Collect end values before database update
> //=============================================
> for ( i=0; i <myform.elements.length; i++ )
> {
elemType = myform.elements[i].type
> switch(elemType)
> {
> case "checkbox" :
> {
> endvals[myform.elements[i].name] =
> myform.elements[i].checked;
> break;
>
> }
> case "text" :
> {
> endvals[myform.elements[i].name] =
> myform.elements[i].value ;
> break;
> }
> case "select-one" : // value doesn't exist in NS4 until
> form is submited
> {
> endvals[myform.elements[i].name] =
> myform.elements[i].value ;
> break;
> }
> default:
> break;
> }
> //===================================================
> // Test for Change on text,drop down and check boxes
> //===================================================
> if( startvals[myform.elements[i].name] !=
> endvals[myform.elements[i].name] )
> {
> logline = logline + 'Field: '+myform.elements[i].name + '- ';
logline += startvals[myform.elements[i].name] + '/';
logoine += endvals[myform.elements[i].name] +', ';
> alert(elemType+''+logline);
>
> }
>
> } // for
> document.myform.logline.value = logline;
> return true
> } //function
> //=======================================================================
> ===
> //=======================================================================
> ===
> //=======================================================================
> ===
>
Roger,
Roger Roelofs Phone 616 574-0480 x246
Datacomp Appraisal Services Fax 616 574-0486
3215 Eaglecrest Drive, NE Suite 100 email rer at datacompusa.com
Grand Rapids, MI 49525-4593 web www.datacompusa.com
More information about the Javascript
mailing list