动态改变CSS
两个按钮点击时,背景颜色交替的改变
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>无标题页</title>
- <style type="text/css">
- .btn1
- {
- background-color:red}
- .btn2
- {
- background-color:Blue}
- </style>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <input id="Button1" type="button" value="产品介绍" class=btn1 οnclick="Button2.className='btn2';Button1.className='btn1'" />
- <input id="Button2" type="button" value="用户体验" class=btn1 οnclick="Button1.className='btn2';Button2.className='btn1'"/></div>
- </form>
- </body>
- </html>