Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: change properties of TR


Message #1 by Dimitriy Dribinskiy <DimitriyD@M...> on Mon, 21 May 2001 12:18:46 -0400
Could someone please help me about this? 
I need to change background of TR in dynamically created table (in NETSCAPE
!!!!!!!!!!!!!).

I wrote this:
<SCRIPT>
NumberOfRows=10;
NumberOfColumns=2;
function testColor(s)
{
	eval('document.form1.TR' + s + '.style.background = "#CCCCCC"')
}
</SCRIPT>

<BODY>
<form id=form1 name=form1>
	<TABLE bgcolor="#000000" cellpadding="0" cellspacing="0" border="0"
width="400" >
		<TR><TD>
			<TABLE bgcolor="#000000" border="0" cellpadding="1"
cellspacing="1" width="400"> 
				<SCRIPT>
				var istring='';
				var TestString='';
				for(i=0; i < NumberOfRows; i++)
				{
					istring = "<TR id=TR" + [ i ] + "
onClick=testColor(" + [ i ] + ")>"; 

					for(l=0; l < NumberOfColumns; l++) 
						istring = istring +
"<TD>row" + [i+1] + " " + "column" + [l+1] + "</TD>";
					istring = istring + "</TR>";
					TestString = TestString + istring;
				} 
				document.writeln(TestString); 
				</SCRIPT>
			</TABLE>
		</TD></TR>
	</TABLE>
</form>
</BODY>


but it does not work
Thanks
Dmitriy


  Return to Index