给个方法:
for (int i = 0; i < DropDownList1.Items.Count; i++)
{
if (i % 2 == 0)
{
DropDownList1.Items[i].Attributes.Add("style","BACKGROUND-COLOR:#008888");
}
}
解决方案 »
- 关于网页广告出现几率的问题?
- 怎样在ASP.NET2.0下实现URL重写
- 如何将页面控件与某个实例类绑定?
- 谁知道济南的一个叫(时纪风信)的软件公司不???急,我女朋友要面试那个公司,我打了半天也没打到,可能是名子错了,哪位大哥帮帮我啊!!
- 我这个多线程程序执行后怎么得不到我想要的结果呢?希望高手们帮忙诊断下
- table如何 绑定数据库 (马上结贴)
- ASP.NET初学者+菜鸟遇到大问题!!!!!
- post和get有啥区别?
- 急问:在线,各位高手看看这是什么原因啊?
- 紧急求助!一个困扰了我很久的问题了!关于程序配置
- 菜鸟第一个网页 局域网内别人看不到
- 用过Infragistics的WebChart控件的朋友请进...
另外,楼主说的WEB控件是HTML控件吧?!好象规范的说法是"HTML控件"吧,有没有看到这个System.Web.UI.HtmlControls;
<select>
<option style="COLOR: #ff0000" value="red"> 红色 </option>
<option style="COLOR: #ffa500" value="orager"> 橙色 </option>
<option style="COLOR: #ffff00" value="yellow"> 黄色 </option>
<option style="COLOR: #008000" value="green"> 绿色 </option>
<option style="COLOR: #32cd32" value="cyan"> 青色 </option>
<option style="COLOR: #0000ff" value="blue"> 蓝色 </option>
<option style="COLOR: #800080" value="purple"> 紫色 </option>
</select>
<asp:DropDownList class="smallselect" onchange=" return setColor();" id="DropDownList2" runat="server">
<asp:ListItem style="COLOR: #ff0000" value="red" selected> 红色 </asp:ListItem>
<asp:ListItem style="COLOR: #ffa500" value="orager"> 橙色 </asp:ListItem>
<asp:ListItem style="COLOR: #ffff00" value="yellow"> 黄色 </asp:ListItem>
<asp:ListItem style="COLOR: #008000" value="green"> 绿色 </asp:ListItem>
<asp:ListItem style="COLOR: #32cd32" value="cyan"> 青色 </asp:ListItem>
<asp:ListItem style="COLOR: #0000ff" value="blue"> 蓝色 </asp:ListItem>
<asp:ListItem style="COLOR: #800080" value="purple"> 紫色 </asp:ListItem>
</asp:DropDownList>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<LINK href="style.css" type="text/css" rel="stylesheet">
<META content="C#" name="CODE_LANGUAGE">
<META content="JavaScript" name="vs_defaultClientScript">
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3199" name="GENERATOR">
</HEAD>
<BODY class="bodycolor" leftMargin="0" topMargin="0" rightMargin="0">
<FORM id="Form1" name="Form1" method="post" runat="server">
<SCRIPT src="images/prototype.ashx" type="text/javascript"></SCRIPT>
<SCRIPT src="images/core.ashx" type="text/javascript"></SCRIPT>
<SCRIPT src="images/converter.ashx" type="text/javascript"></SCRIPT>
<SCRIPTsrc="images/AnyOffice.general.netmeeting.attend.AjaxMethods,
AnyOffice.ashx"type="text/javascript"></SCRIPT>
<TABLE class="small" cellSpacing="1" cellPadding="3" width="101%" bgColor="#000000" border="0">
<TBODY>
<TR class="TableHeader">
<TD><SPAN>对象
<asp:DropDownList class="SmallSelect" id="DropDownList1" runat="server"></asp:DropDownList>
悄悄话
<INPUT id="IsPrivate" type="checkbox" value="checkbox" name="IsPrivate">
字色
<asp:DropDownList class="smallselect" onchange=" return setColor();" id="DropDownList2" runat="server">
<asp:ListItem style="COLOR: #ff0000" value="red" selected>红色</asp:ListItem>
<asp:ListItem style="COLOR: #ffa500" value="orager">橙色</asp:ListItem>
<asp:ListItem style="COLOR: #ffff00" value="yellow">黄色</asp:ListItem>
<asp:ListItem style="COLOR: #008000" value="green">绿色</asp:ListItem>
<asp:ListItem style="COLOR: #32cd32" value="cyan">青色</asp:ListItem>
<asp:ListItem style="COLOR: #0000ff" value="blue">蓝色</asp:ListItem>
<asp:ListItem style="COLOR: #800080" value="purple">紫色</asp:ListItem>
</asp:DropDownList>
<SCRIPT>
var messageColor='red'; function setColor()
{
var selectColor = document.getElementById('selectColor');
messageColor=selectColor.value;
}
</SCRIPT>就是这里 请大家在看看有没有外面把里面的颜色覆盖的地方
自动滚动<INPUT id="chScroll" type="checkbox" CHECKED name="chScroll"> </SPAN>
</TD>
</TR>
<TR class="TableHeader">
<TD height="30">
<asp:TextBox class="SmallInput" id="TextBox1" runat="server" MaxLength="100" Width="500px"></asp:TextBox>
<asp:Button class="SmallButton" id="Button1" runat="server" Text="发言"></asp:Button>
</TD>
</TR>
</TBODY>
</TABLE>
<SCRIPT language="javascript">
//回车键发送消息
function clickButton(e, buttonid)
{
var bt = document.getElementById(buttonid);
if (typeof bt == 'object')
{
if(navigator.appName.indexOf("Netscape")>(-1)){
if (e.keyCode == 13)
{
bt.click();
return false;
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
{
if (event.keyCode == 13)
{
bt.click();
return false;
}
}
}
} function GetUsers()
{
if(timer_user!=null)
window.clearTimeout(timer_user);
AnyOffice.general.netmeeting.attend.AjaxMethods.GetOnline(1,CallBack_GetUsers);
timer_user=setTimeout("GetUsers()",30000);
}function SayTo(userId)
{
var oSelect = document.getElementById("selectOnlineUsers");
for(var i=0;i<oSelect.length;i++)
{
if(oSelect.options[i].value == userId)
{
oSelect.options[i].selected = true;
}
}}function CallBack_GetUsers(res)
{
if(res != null && res.value != null && res.value.Tables != 0 && res.value.Tables.length == 1)
{
var selectValue="";
var usersList="";
var onlineNums=0;
var opt;
var oSelect = document.getElementById("selectOnlineUsers");
selectValue = oSelect.value;
// clear dropdownlist
for(var i=oSelect.length-1; i>0; i--)
{
oSelect.options[i] = null;
}
for(var i=0; i<res.value.Tables[0].Rows.length; i++)
{
usersList += "<a href=\"javascript:parent.chat_input.SayTo('" + res.value.Tables[0].Rows[i].UserId + "');\">" + res.value.Tables[0].Rows[i].NickName + "</a><br>"
opt = new Option(res.value.Tables[0].Rows[i].NickName, res.value.Tables[0].Rows[i].UserId);
oSelect.options[oSelect.length] = opt;
onlineNums +=1;
}
var oOnlineNums = parent.chat_user.document.getElementById("onlineNums")
if(oOnlineNums != null)
oOnlineNums.innerHTML = "在线人员" + onlineNums + "人";
var onlineUsersList = parent.chat_user.document.getElementById("onlineUsersList")
if(onlineUsersList != null)
onlineUsersList.innerHTML = usersList;
for(var i=0;i<oSelect.length;i++)
{
if(oSelect.options[i].value == selectValue)
{
oSelect.options[i].selected = true;
}
}
}
}function SendMessage()
{
var color = messageColor;
var content = document.getElementById('txtMsg').value;
if(content == "")
return;
var oSelect = document.getElementById("selectOnlineUsers");
var toId = oSelect.value;
var isPrivate = document.all.IsPrivate.checked; //输入框清空
document.getElementById('txtMsg').value=''; AnyOffice.general.netmeeting.attend.AjaxMethods.SendMessage(1, toId, color, isPrivate, content);
}GetMessage();
GetUsers(); </SCRIPT>
</FORM>
</BODY>
</HTML>
我想,你新建一个网页试试看。
另外,你既已声明<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">,最就按这个标准,尽量不要在HTML里出现不规范的字符,如大小写,属性等。