grab cell () bgcolor with onClick and put it in a input type text...

Giganews Newsgroups
Subject: grab cell (<TD>) bgcolor with onClick and put it in a input type text...
Posted by:  an…@cyber-wizard.com (A.S.)
Date: 28 Jul 2003

Hi,

I have the following simple code:

<TABLE><TR>
<TD BGCOLOR="#FFFFFF" ONCLICK="myform.color.value =
this.bgcolor">hello</TD>
</TR></TABLE>

<FORM ACTION="hello.cgi" NAME="myform" ID="myform">
<INPUT TYPE="text" NAME="color" SIZE="10" MAXLENGTH="10">
</FORM>

When I click on the cell, the text input box shows 'undefined'. How
can I insert the cell's bgcolor hex code (#FFFFFF) into the form's
box.

Thanks,
A.S.

Replies