Print Page | Close Window

make td to the color in textfield

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3875
Printed Date: 30 March 2026 at 4:29am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: make td to the color in textfield
Posted By: aero
Subject: make td to the color in textfield
Date Posted: 27 June 2003 at 8:45am

Hi.

if i have this code in a asp site

<form name="colorForm">
<td>
<input name="inColor" type="text" value="">
</td><td width="30"></td>
</form>

if I write a color code in my textfield like: #FFCC99

How can I then make the TD behind the input changes color to FFCC99 so when I type a color no. then the color ex. will be showet in the TD !???




Replies:
Posted By: MorningZ
Date Posted: 27 June 2003 at 11:02am

quick few mins with some javascript and here ya go....

< id=1 name=1>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<script language="javascript">
<!--
function ChangeColor() {
 var thisColor = document.forms['Form1']['color'].value;
 document.getElementById("cell").style.backgroundColor = thisColor;
}
//-->
</script>
</HEAD>
<BODY>

<form name="Form1" id="Form1">
<table cellpadding="10" border="1">
 <tr>
  <td id="cell">
   <div><input type="text" size="15" maxlength="7" name="color" onBlur="ChangeColor()"/></div>
  </td>
 </tr>
</table>
</form>

</BODY>
</HTML>



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: MorningZ
Date Posted: 27 June 2003 at 11:03am

disregard: "< id=1 name=1>"

dunno why the post box added that



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net