改颜色:
.aspx :
%@ Page Language=C# AutoEventWireup=true CodeFile=SessionTest.aspx.cs Inherits=SessionTest %
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN /TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=/1999/xhtml
head runat=server
title无标题页/title
link rel=Stylesheet href=test.css type=text/css/
script type=text/javascript
function ChangeColor()
{
document.body.bgColor = %=bgcolor%;
}
/script
/head
body οnlοad=ChangeColor()
form id=form1 runat=server
div
asp:Button ID=Button1 runat=server OnClick=Button1_Click Text=Button /
asp:Button ID=Button2 runat=server Text=Button /
/div
/form
/body
/html
.aspx.cs 里
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;
public partial class SessionTest : System.Web.UI.Page
{
protected string bgcolor;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
bgcolor = red;
}
}
取消
评论
net如何在aspx页面中将html页面快速的加入runat 中在aspx.cs向aspx页面写代码有哪几种方法?...