Is this better?
<!-- HEAD //-->
<SCRIPT LANGUAGE=javascript>
<!--
values=new Array(2);
values[0]="First";
values[1]="Second";
function set(){
//get's the form
form=document.forms[0];
//get's the length of form elements
elements=form.elements.length;
for (i=0;i<elements;i++){
if(form.elements[i].type=="text"){ //all text-type form
elements
form.elements[i].value=values[i];//are set after
values array
}
}
}
//-->
</SCRIPT>
<!-- BODY //-->
<form>
1.<input type="text">
2.<input type="text">
<br>
<input type="button" onclick="set()" value="Click me">
</form>
Teemu
-----Alkuperainen viesti-----
Lahettaja: Imar Spaanjaars [mailto:Imar@S...]
Lahetetty: 18. helmikuuta 2001 22:36
Vastaanottaja: javascript
Aihe: [javascript] Re: VS: Re: Fwd: Re: Help
Did you forget to post the code for the Set() function? I see that you call
it in the OnClick event, but I didn't see the code for the function.
Can you please repost this?
Imar
At 06:15 PM 2/18/2001 +0200, you wrote:
>Hi!
>
>Is this something you're after?
>
>1. 2.
>
>That form.elements.length "thing" counts also every button in form. Every
>element in form.
>This example works because these text elements are before any other form
>element. If there are some other elements between text boxes one have to
>somehow keep track of them if using indexes of arrays and form elements.
>
>This works on IE5 , NN 4.7,NN6 and Opera 5.01.
>
>Teemu Keiski