@KorFeb 23.2010 — #Could be something like this (but it depends on how you want to interpret the hexa values when the user enters 1,2,3,4,5,6 characters) <i> </i><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <style type="text/css"> #box { height: 25px; width: 25px; border:solid 1px #000; } </style> <script type="text/javascript"> function showColor(color){ switch(color.length){ case 1: color=color+color+color; break; case 2: color=color+color+color; break; case 3: var s=color.split(''); color=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]; break; case 6: color=color; break; default: return } var obj=document.getElementById('box'); obj.style.backgroundColor='#'+color; } </script> </head> <body> <form action=""> <input type="text" onkeyup="showColor(this.value)" onblur="showColor(this.value)"> <div id="box"></div> </form> </body> </html>
I really suck at JavaScript [/quote] Next time either you learn javascript or you hire someone to do the job. There is no middle way in programming.