有N个button 也就是说button的个数不定,
当点击一个button时,此button的样式变为突出或改变背景色
其他的样式还原为初始样式。
解决方案 »
- 网站母版页
- 回复发送至邮箱出现乱码怎么办?
- asp.net页面下,点击“生成”按钮后,由程序检索数据库信息表,生成一个 word 文档
- repeate如何一行显示多列
- 要做集团个分公司的网站,由于集团包括10多个子公司,大的模块相同(如新闻,论坛...),但是也有一些小模块不同(如餐饮公司的和地产公司的就有
- 请问如何在绑定输出时,转换形式输出??
- 使用Forms验证,在没login时,如何实现跳转到不同的登录页面?
- 控制弹出对话框的显示问题!!请大家帮忙!
- select like 值中有空格怎么办?
- 大文本显示显示的问题~
- 我要重写URL,问个web.config的问题
- excel , word 、PPT文档转换成HTML,怎样去设置该页面不能复制粘贴、禁右键和另存为
<input type=button id="d2" onclick="changecolor(this.id);">
<input type=button id="d3" onclick="changecolor(this.id);">
<input type=button id="d4" onclick="changecolor(this.id);">
<input type=button id="dn" onclick="changecolor(this.id);">
function changecolor(id)
{
var bs=document.getElementbytag("input");
for(i=0;i<bs.length;i++)
{
if(bs[i].type="button")
{
if(bs[i].id==id)
//这个是你当前处理的.
bs[i].style.xxxx=xxxx;
else
{
bs[i].style.xxxx=默认的;
}}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="testjavascript.WebForm1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title></title>
<style type="text/css">
.buttonBorder{ border:1px solid red;}
</style></head>
<body>
<form id="form1" runat="server">
<input type="button" value="button1" onclick="changeColor(this)"/>
<input type="button" value="button2" onclick="changeColor(this)"/>
<input type="button" value="button3" onclick="changeColor(this)"/>
<input type="button" value="button4" onclick="changeColor(this)"/>
<input type="button" value="button5" onclick="changeColor(this)"/>
</form><script type="text/javascript">function changeColor(obj)
{
var inputs=document.getElementById("form1").getElementsByTagName("input");
for(var i=0;i<inputs.length;i++)
{
if(inputs[i].type=="button")
{
inputs[i].style.borderColor="";
}
}
obj.style.borderColor="red";
}</script>
</body></html>