[Javascript] Text Field Arrays

Jay Lepore admin at myinternethandyman.com
Tue May 1 23:17:42 CDT 2001


Hi there,

OK, here's my specific problem.

I've got an array of 6 text fields.

<form name='configurator'>
    <input type='text' name='files_description[0]' size='18' maxlength='30'
onBlur='return nochanging(this, 0)'>";
    <input type='text' name='files_description[1]' size='18' maxlength='30'
onBlur='return nochanging(this, 1)'>";
    <input type='text' name='files_description[2]' size='18' maxlength='30'
onBlur='return nochanging(this, 2)'>";
    <input type='text' name='files_description[3]' size='18' maxlength='30'
onBlur='return nochanging(this, 3)'>";
    <input type='text' name='files_description[4]' size='18' maxlength='30'
onBlur='return nochanging(this, 4)'>";
    <input type='text' name='files_description[5]' size='18' maxlength='30'
onBlur='return nochanging(this, 5)'>";
</form>

I want to populate the values of one of those text fields onBlur so the
value is predetermined so I wrote this:

<script language='JavaScript'>
function nochanging(elem,elementNum){

var changeto;

switch(elementNum)
        {
        case '1':   changeto="Home Top Left"; break
        case '2':   changeto="Home Top Right"; break
        case '3':   changeto="Property List Top Left"; break
        case '4':   changeto="Property List Top Right"; break
        case '5':   changeto="Sale Sheet Top Left"; break
        case '6':   changeto="Sale Sheet Top Right"; break
        }

window.document.configurator.files_description[elementNum].value=changeto;
}
</script>

It errors out every time. Could you tell me how to dynamically set the value
of a text field that is built on an array?


Your help is hugely appreciated.

Sincerely,


Tiffany
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010502/1da42a10/attachment.htm>


More information about the Javascript mailing list