Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: grouping INPUTs


Message #1 by payam <torkian@c...> on Tue, 28 Jan 2003 10:37:43 +0330 (IRT)
Well, it depends if you have them in different FORMS or TR etc.

Here's one example:

<form>
	<table>
		<tr id=3D"firstTR">
			<td>
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
			</td>
		</tr>
		<tr id=3D"secondTR">
			<td>
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
			</td>
		</tr>
		<tr id=3D"thirdTR">
			<td>
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
				<input type=3D"text"
style=3D"background:red; color:blue; font:bold 12px Verdana;">
			</td>
		</tr>
	</table>
</form>



<a href=3D# onClick=3D"disableTRInputs(0); return false">Disable first
row</a>
<a href=3D# onClick=3D"disableTRInputs(1); return false">Disable second
row</a>
<a href=3D# onClick=3D"disableTRInputs(2); return false">Disable third
row</a>


function disableTRInputs(intTR){
	var arrTR =3D new Array("firstTR", "secondTR", thirdTR);
	var oSelectedTR =3D document.getElementById(arrTR[intTR]);
	var arrAllTRInputs =3D oSelectedTR.getElementsByTagName("input");
	for(var i=3D0; i<arrAllTRInputs.length; i++){
		arrAllTRInputs.disabled=3Dtrue;
	}=09
}



/Robert





-----Original Message-----
From: payam [mailto:torkian@c...]
Sent: den 28 januari 2003 08:08
To: JavaScript HowTo
Subject: [javascript_howto] grouping INPUTs


hello again
my second question is that how can I group my INPUTs?(for example in
separate arrays)

for example I want the INPUTs under any ANCHORs to change to "read only"
INPUT's when I click on their ANCHORs:

<a>group1</a>
 <INPUT>
 <INPUT>
 <INPUT>

<a>group2</a>
 <INPUT>
 <INPUT>
 <INPUT>

<a>group3</a>
 <INPUT>
 <INPUT>
 <INPUT>





  Return to Index