View Single Post
Old 02-03-2004, 03:28 AM   PM User | #6
shlagish
Senior Coder

 
Join Date: Apr 2003
Location: Canada
Posts: 1,063
Thanks: 2
Thanked 0 Times in 0 Posts
shlagish is an unknown quantity at this point
Well, I had a try in black and white. Tell me what ya think.

I know there might be a lot of useless stuff in there and bad stuff but you know, it's the first version of the script and it's late. I might clean it up tomorrow, gotta go to bed.
Enjoy.


Code:
<html>
<head>
<script type="text/javascript">
<!--

function appear()
{
xPos=event.clientX;
yPos=event.clientY;
color_box.style.visibility="visible";
color_box.style.left=xPos;
color_box.style.top=yPos;
}

function change(new_color)
{
document.bgColor=new_color;
color_box.style.visibility="hidden";
}

function convert(c)
{
return parseInt(c, 10).toString(16);
}

-->
</script>
</head>
<body>

<table id="color_box" align="center" border="0" cellpading="0" cellspacing="1" style="visibility: hidden; position: absolute;">
<tr>

<script type="text/javascript">
<!--

for (c = 0; c <= 255; c++)

{
n=convert(c)
if (n < 10) 
{
n="0"+n
}
else
{
n=n
}

if (c%16 == 0){

document.write("</tr><tr>")
}
m=n.toUpperCase()
t="#";
b=t+n+n+n.toString();
l='<td width="10px" height="10px" onClick="change(\''+b+'\')" bgcolor="#'+n+n+n+'" title="'+m+m+m+'"></td>'
document.write(l)
}
-->
</script>

</tr>
</table>
<a href="#" onClick="appear()">Click to change</a>
</body>
</html>
Cya

btw, when you see this line:
l='<td width="10px" height="10px" onClick="change(\''+b+'\')" bgcolor="#'+n+n+n+'" title="'+m+m+m+'"></td>'

there sould be an upside down / here: change(upside down / ''+b... and here: b+'upsidedown /')"...

For some reason, it doesn't appear when I post. Can someone explain?
__________________
Shawn

Last edited by shlagish; 02-03-2004 at 03:37 AM..
shlagish is offline   Reply With Quote