怎样在网页中嵌入颜色菜单?很急,在线等!

LIHY70 2005-03-29 01:44:34
怎样在网页中嵌入颜色菜单?













































































?
...全文
124 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
LIHY70 2005-03-29
  • 打赏
  • 举报
回复
感谢各位高手!再次感谢大家!
hhjjhjhj 2005-03-29
  • 打赏
  • 举报
回复
<script>
function callColorDlg(){
var sColor = dlgHelper.ChooseColorDlg();
alert(sColor);
}
</script>
<html>
<body>
<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
</OBJECT>
<input type=button onclick="callColorDlg()" value="selectcolor">
</body>
</html>
TSD 2005-03-29
  • 打赏
  • 举报
回复
tsd.htm
------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>SD在线编辑颜色选择示例</title>
<meta name="keywords" content="SD在线编辑颜色选择示例 POWER BY SD WEB:http://www.fanzny.com">
<script language="javascript">
<!--
// SD在线编辑颜色选择示例
// POWER BY SD
// WEB:http://www.fanzny.com
// EMAIL:fanzny@21cn.com
// QQ:61192909

function sdSetfColor()
{
var rv = showModalDialog("selcolor.htm", "wcolor", "dialogWidth:300px; dialogHeight:220px;status:no;help:yes");
if (rv != null){
frames.sdwedit.focus();
frames.sdwedit.document.execCommand('ForeColor',true,rv);
}
else frames.sdwedit.focus();
}

//-->
</script>
</head>
<body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25"><a href="javascript:sdSetfColor()">颜色</a></td>
</tr>
<tr>
<td height="388"><iframe src="about:blank" id="sdwedit" width="100%" height="100%"></iframe></td>
</tr>
</table>
<script language="javascript">frames.sdwedit.document.designMode = "On";</script>
</body>
</html>


selcolor.htm
--------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>SD颜色选择器</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="SD颜色选择器 POWER BY SD WEB:http://www.fanzny.com">
<SCRIPT LANGUAGE=JavaScript>
// SD在线编辑颜色选择示例
// POWER BY SD
// WEB:http://www.fanzny.com
// EMAIL:fanzny@21cn.com
// QQ:61192909

var SelRGB = '#000000';
var DrRGB = '';
var SelGRAY = '120';

var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');

function ToHex(n)
{ var h, l;

n = Math.round(n);
l = n % 16;
h = Math.floor((n / 16)) % 16;
return (hexch[h] + hexch[l]);
}

function DoColor(c, l)
{ var r, g, b;

r = '0x' + c.substring(1, 3);
g = '0x' + c.substring(3, 5);
b = '0x' + c.substring(5, 7);

if(l > 120)
{
l = l - 120;

r = (r * (120 - l) + 255 * l) / 120;
g = (g * (120 - l) + 255 * l) / 120;
b = (b * (120 - l) + 255 * l) / 120;
}else
{
r = (r * l) / 120;
g = (g * l) / 120;
b = (b * l) / 120;
}

return '#' + ToHex(r) + ToHex(g) + ToHex(b);
}

function EndColor()
{ var i;

if(DrRGB != SelRGB)
{
DrRGB = SelRGB;
for(i = 0; i <= 30; i ++)
GrayTable.rows(i).bgColor = DoColor(SelRGB, 240 - i * 8);
}

SelColor.value = DoColor(RGB.innerText, GRAY.innerText);
ShowColor.bgColor = SelColor.value;
}
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onclick>
SelRGB = event.srcElement.bgColor;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseover>
RGB.innerText = event.srcElement.bgColor.toUpperCase();
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=ColorTable EVENT=onmouseout>
RGB.innerText = SelRGB;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onclick>
SelGRAY = event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseover>
GRAY.innerText = event.srcElement.title;
EndColor();
</SCRIPT>

<SCRIPT LANGUAGE=JavaScript FOR=GrayTable EVENT=onmouseout>
GRAY.innerText = SelGRAY;
EndColor();
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript FOR=Ok EVENT=onclick>
window.returnValue = SelColor.value;
window.close();
</SCRIPT>
<style type="text/css">
<!--
body {
background-color: #D6D3CE;
}
-->
</style>
</HEAD>
<BODY bgcolor=menu>
<table width="100%" height="122" border="0" cellpadding="0" cellspacing="0">
<tr align="center" valign="top">
<td height="34" colspan="3"><table border="0" cellspacing="10" cellpadding="0">
<tr>
<td><TABLE ID=ColorTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:pointer'>
<SCRIPT LANGUAGE=JavaScript>
function wc(r, g, b, n)
{
r = ((r * 16 + r) * 3 * (15 - n) + 0x80 * n) / 15;
g = ((g * 16 + g) * 3 * (15 - n) + 0x80 * n) / 15;
b = ((b * 16 + b) * 3 * (15 - n) + 0x80 * n) / 15;

document.write('<TD BGCOLOR=#' + ToHex(r) + ToHex(g) + ToHex(b) + ' height=8 width=8></TD>');
}

var cnum = new Array(1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0);

for(i = 0; i < 16; i ++)
{
document.write('<TR>');
for(j = 0; j < 30; j ++)
{
n1 = j % 5;
n2 = Math.floor(j / 5) * 3;
n3 = n2 + 3;

wc((cnum[n3] * n1 + cnum[n2] * (5 - n1)),
(cnum[n3 + 1] * n1 + cnum[n2 + 1] * (5 - n1)),
(cnum[n3 + 2] * n1 + cnum[n2 + 2] * (5 - n1)), i);
}

document.writeln('</TR>');
}
</SCRIPT>
</TABLE></td>
<td><TABLE ID=GrayTable BORDER=0 CELLSPACING=0 CELLPADDING=0 style='cursor:hand'>
<SCRIPT LANGUAGE=JavaScript>
for(i = 255; i >= 0; i -= 8.5)
document.write('<TR BGCOLOR=#' + ToHex(i) + ToHex(i) + ToHex(i) + '><TD TITLE=' + Math.floor(i * 16 / 17) + ' height=4 width=20></TD></TR>');
</SCRIPT>
</TABLE></td>
</tr>
</table></td>
</tr>
<tr style="display:none">
<td colspan="3">基色:<span id=RGB>#000000 </span>亮度:<span id=GRAY>120</span> 色值:
<INPUT TYPE=TEXT SIZE=7 ID=SelColor value="#000000"></td>
</tr>
<tr>
<td width="2%" height="33"> </td>
<td width="20%"><table ID=ShowColor bgcolor="#000000" border="1" width="25" height="25" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table></td>
<td width="78%"><input type="submit" id=Ok value="确定" style="width:80;height:25">
<input type="button" name="Close" value="取消" onClick=window.close(); style="width:80;height:25"></td>
</tr>
</table>
</BODY>
</HTML>
myvicy 2005-03-29
  • 打赏
  • 举报
回复
用session保存选项。
LIHY70 2005-03-29
  • 打赏
  • 举报
回复
有没有高手在呀!救救我呀!
LIHY70 2005-03-29
  • 打赏
  • 举报
回复
聊天室里面,设置聊天信息字体的颜色的那个颜色菜单
LIHY70 2005-03-29
  • 打赏
  • 举报
回复
就是象yahoo里写信页面上的那个颜色菜单或者聊,选择颜色,设置文本框中文字的颜色!
leo963258 2005-03-29
  • 打赏
  • 举报
回复
<layer id="">aaa</layer>
LIHY70 2005-03-29
  • 打赏
  • 举报
回复
请各位高手帮忙!
TSD 2005-03-29
  • 打赏
  • 举报
回复
什么意思?

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧