.forecolor???

cqs76 2003-09-12 07:09:18
<%@ Page Language="vb" %>
<HTML>
<HEAD>
<title>changecolor</title>

<script language="vb" runat="server">
sub cli(sender as object,e as eventargs)
if(tc.forecolor=#808080) then
tc.forecolor=#993333
else '###############################
tc.ForeColor=#808080 '此行报错说:BC30201: 需要表达式
end if '###############################
end sub
</script>

</HEAD>
<BODY text="navy">
<form runat="server">
<asp:label ID="tc" Runat="server" text="HELLO,ASP.NET!" />
<asp:Button ID="bc" Runat="server" text="改变颜色" OnClick="cli" />
</form>
</BODY>
</HTML>


asp.net我刚看了不久,vb的写法在这里似乎不太适应啊!!

...全文
108 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
panyee 2003-09-12
  • 打赏
  • 举报
回复
你为什么不新建项目写?? 不熟悉尽量少用 记事本来写代码

一,可以直接改样式单
tc.Style("color") = "#808080"

二,用它本身的属性
Label1.ForeColor = Color.FromName("#00FF00")
Private Sub cmdClose_Click() On Error GoTo Err_cmdClose_Click If MsgBox("是否确定退出系统?", vbQuestion + vbYesNo, "系统提示") = vbYes Then DoCmd.Quit Else Exit Sub End If Exit_cmdClose_Click: Exit Sub Err_cmdClose_Click: MsgBox Err.Description Resume Exit_cmdClose_Click End Sub Private Sub cmdOK_Click() On Error GoTo Err_cmdOK_Click '第一步 判断用户情况 Call cobUser_LostFocus If blnAsUser = True Then Me.cobUser.SetFocus Exit Sub Else Me.txtPwd.SetFocus End If '第二步 判断密码情况 Call txtPwd_LostFocus If blnAsPwd = True Then Me.txtPwd.SetFocus Exit Sub Else Me.lblPwd.ForeColor = RGB(0, 100, 0) Me.lblPwd.Caption = "√" 'MsgBox "测试通过 用户ID =" & userID MsgBox "测试通过!" Me.Visible = False End If Exit_cmdOK_Click: Exit Sub Err_cmdOK_Click: MsgBox Err.Description Resume Exit_cmdOK_Click End Sub Private Sub cobUser_LostFocus() On Error GoTo Err_cobUser_LostFocus blnAsUser = False Dim blnUser As Boolean blnUser = False If IsNull(Me.cobUser) Then Me.lblUser.ForeColor = RGB(255, 0, 0) Me.lblUser.Caption = "× 用户名不能为空" blnAsUser = True '当此处不退出,则会运行到 用户不存在的错误提示 Exit Sub End If Set rsAs = New ADODB.Recordset strAsSQL = "SELECT tb_user.用户ID,tb_user.用户名 FROM tb_user" rsAs.Open strAsSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic rsAs.MoveFirst For iAs = 1 To rsAs.RecordCount If rsAs!用户名 = Me!cobUser Then blnUser = True iAs = rsAs.RecordCount + 1 '赋值给全局变量,适用于模块 Macro_modUsersLog Else rsAs.MoveNext End If Next iAs rsAs.Close Set rsAs = Nothing If blnUser = False Then Me.lblUser.ForeColor = RGB(255, 0, 0) Me.lblUser.Caption = "× 用户不存在" blnAsUser = True Exit Sub Else Me.lblUser.ForeColor = RGB(0, 100, 0) Me.lblUser.Caption = "√" End If Exit_cobUser_LostFocus: Exit Sub Err_cobUser_LostFocus: MsgBox Err.Description Resume Exit_cobUser_LostFocus End Sub Private Sub txtPwd_LostFocus() On Error GoTo Err_txtPwd_LostFocus blnAsPwd = False If IsNull(Me.cobUser) Then Me.lblPwd.Caption = "" Me.cobUser.SetFocus Exit Sub End If If IsNull(Me.txtPwd) Then Me.lblPwd.ForeColor = RGB(255, 0, 0) Me.lblPwd.Caption = "× 密码不能为空" blnAsPwd = True End If If DLookup("密码", "tb_user", "[用户名]=" & "'" & Me!cobUser & "'") <> Me!txtPwd Then Me.lblPwd.ForeColor = RGB(255, 0, 0) Me.lblPwd.Caption = "× 密码错误" blnAsPwd = True End If Exit_txtPwd_LostFocus: Exit Sub Err_txtPwd_LostFocus: MsgBox Err.Description Resume Exit_txtPwd_LostFocus End Sub
一个不错的画图控件, 基本属性 ———————————————— ID System.String ShowCopyright System.Boolean InflateWidth System.Int32 InflateHeight System.Int32 ShowErrorInfo System.Boolean Colorful System.Boolean AutoBarWidth System.Boolean Alpha3D System.Byte Depth3D System.Int32 Dimension FanG.Chartlet.ChartDimensions RootPath System.String ImageFolder System.String ChartType FanG.Chartlet.ChartTypes GroupSize System.Int32 MaxValueY System.Double MinValueY System.Double RoundRectangle System.Boolean RoundRadius System.Int32 LineConnectionType FanG.Chartlet.LineConnectionTypes LineConnectionRadius System.Int32 AppearanceStyle FanG.Chartlet.AppearanceStyles 复合属性 ———————————————— ChartTitle FanG.TextAttributes Text System.String Show System.Boolean Font System.Drawing.Font ForeColor System.Drawing.Color BackColor System.Drawing.Color Fill FanG.Painting ColorStyle FanG.Chartlet+ColorStyles ShiftStep System.Int32 TextureStyle System.Drawing.Drawing2D.HatchStyle Color1 System.Drawing.Color Color2 System.Drawing.Color Color3 System.Drawing.Color TextureEnable System.Boolean Stroke FanG.StokeStyle Width System.Int32 ColorStyle FanG.Chartlet+ColorStyles ShiftStep System.Int32 TextureStyle System.Drawing.Drawing2D.HatchStyle Color1 System.Drawing.Color Color2 System.Drawing.Color Color3 System.Drawing.Color TextureEnable System.Boolean Crystal FanG.CrystalAttributes Enable System.Boolean CoverFull System.Boolean Contraction System.Int32 Direction FanG.Chartlet.Direction Shadow FanG.ShadowAttributes Enable System.Boolean Radius System.Int32 Distance System.Int32 Color System.Drawing.Color Alpha System.Byte Angle System.Single Hollow System.Boolean ColorGuider FanG.Attributes Show System.Boolean Font System.Drawing.Font ForeColor System.Drawing.Color BackColor System.Drawing.Color Tips FanG.Attributes Show System.Boolean Font System.Drawing.Font ForeColor System.Drawing.Color BackColor System.Drawing.Color YLabels FanG.LabelsAttributes UnitText System.String UnitFont System.Drawing.Font Show System.Boolean Font System.Drawing.Font ForeColor System.Drawing.Color BackColor System.Drawing.Color XLabels FanG.XLabelsAttributes SampleSize System.Int32 RotateAngle System.Single UnitText System.String UnitFont System.Drawing.Font Show System.Boolean Font System.Drawing.Font ForeColor System.Drawing.Color BackColor System.Drawing.Color ———————————————— End of document

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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