asp点击按钮改变单元格背景,就像在线考试时,通过改变单元格的背景色来标记已做的题
<scriptlanguage="javascript">functionChangeColor(id,x,y){this.GridView1.Rows[1].Cells...
<script language="javascript">
function ChangeColor(id,x,y){
this.GridView1.Rows[1].Cells[1].BackColor = System.Drawing.Color.Red;
} </script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:expression(body.clientWidth/3);
top:expression(body.clientHeight/5+body.scrollTop);
width:383px;
height:253px;
z-index:1;
overflow: visible;
left: 421px;
top: 18px;
}
body {
background-image: url(backpicture.gif);
background-repeat: repeat-x;
}
#Layer2 {
position:absolute;
left:463px;
top:397px;
width:468px;
height:28px;
z-index:2;
}
#Layer3 {
position:absolute;
left:82px;
top:expression(body.clientHeight/5+body.scrollTop);
width:333px;
height:404px;
z-index:3;
}
#Layer4 {
position:absolute;
left:826px;
top:114px;
width:157px;
height:77px;
z-index:4;
}
-->
</style>
<div id="Layer1">
<table height="100%" width="100%" border="1" align="center">
<%for i=0 to 5%>
<tr align="center" >
<%for j=1 to 10%>
<%k=i*10+j%>
<%if k mod 10=0 then%>
<td bgcolor="#00FF00" id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%else%>
<td id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%end if%>
<%next%>
</tr>
<%next%>
</table>
</div>
<div id="Layer2"><a href="../index.html" target="_self">[点此返回首页]</a></div>
<div id="Layer3">
<form id="form1" name="form1" method="post" action="">
<p>
<table id="table_bg" height="100%" width="100%" border="1" align="center">
<%for i=1 to 10%>
<tr align="center" ><td width="20%"align="center">
第<%=i%>题</td><td align="center">
<label>
<input type="radio" name="<%=i%>" value="A" onClick="ChangeColor(i)"/>
A</label>
<label>
<input type="radio" name="<%=i%>" value="B" onClick="ChangeColor(i)"/>
B</label>
<label>
<input type="radio" name="<%=i%>" value="C" onClick="ChangeColor(i)"/>
C</label>
<label>
<input type="radio" name="<%=i%>" value="D" onClick="ChangeColor(i)"/>
D</label></td>
</tr>
<%next%>
</table>
</p>
</form>
</div> 展开
function ChangeColor(id,x,y){
this.GridView1.Rows[1].Cells[1].BackColor = System.Drawing.Color.Red;
} </script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:expression(body.clientWidth/3);
top:expression(body.clientHeight/5+body.scrollTop);
width:383px;
height:253px;
z-index:1;
overflow: visible;
left: 421px;
top: 18px;
}
body {
background-image: url(backpicture.gif);
background-repeat: repeat-x;
}
#Layer2 {
position:absolute;
left:463px;
top:397px;
width:468px;
height:28px;
z-index:2;
}
#Layer3 {
position:absolute;
left:82px;
top:expression(body.clientHeight/5+body.scrollTop);
width:333px;
height:404px;
z-index:3;
}
#Layer4 {
position:absolute;
left:826px;
top:114px;
width:157px;
height:77px;
z-index:4;
}
-->
</style>
<div id="Layer1">
<table height="100%" width="100%" border="1" align="center">
<%for i=0 to 5%>
<tr align="center" >
<%for j=1 to 10%>
<%k=i*10+j%>
<%if k mod 10=0 then%>
<td bgcolor="#00FF00" id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%else%>
<td id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%end if%>
<%next%>
</tr>
<%next%>
</table>
</div>
<div id="Layer2"><a href="../index.html" target="_self">[点此返回首页]</a></div>
<div id="Layer3">
<form id="form1" name="form1" method="post" action="">
<p>
<table id="table_bg" height="100%" width="100%" border="1" align="center">
<%for i=1 to 10%>
<tr align="center" ><td width="20%"align="center">
第<%=i%>题</td><td align="center">
<label>
<input type="radio" name="<%=i%>" value="A" onClick="ChangeColor(i)"/>
A</label>
<label>
<input type="radio" name="<%=i%>" value="B" onClick="ChangeColor(i)"/>
B</label>
<label>
<input type="radio" name="<%=i%>" value="C" onClick="ChangeColor(i)"/>
C</label>
<label>
<input type="radio" name="<%=i%>" value="D" onClick="ChangeColor(i)"/>
D</label></td>
</tr>
<%next%>
</table>
</p>
</form>
</div> 展开
1个回答
展开全部
试试是不是你要的效果.
<script language="javascript">
function ChangeColor(x){
tabs=document.getElementById("tab")
tab.cells[x-1].style.background = "#00FF00";
}
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:expression(body.clientWidth/3);
top:expression(body.clientHeight/5+body.scrollTop);
width:383px;
height:253px;
z-index:1;
overflow: visible;
left: 421px;
top: 18px;
}
body {
background-image: url(backpicture.gif);
background-repeat: repeat-x;
}
#Layer2 {
position:absolute;
left:463px;
top:397px;
width:468px;
height:28px;
z-index:2;
}
#Layer3 {
position:absolute;
left:82px;
top:expression(body.clientHeight/5+body.scrollTop);
width:333px;
height:404px;
z-index:3;
}
#Layer4 {
position:absolute;
left:826px;
top:114px;
width:157px;
height:77px;
z-index:4;
}
-->
<做敏/style>
<div id="Layer1">
<table height="100%" width="100%" border="1" align="center" id="tab">
<%for i=0 to 5%>
<tr align="center" >
<%for j=1 to 10%>
<%k=i*10+j%>
<%if k mod 10=0 then%>
<td bgcolor="#00FF00" id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>悉纤
<%else%>
<td id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%end if%>
<%next%>
</tr>
<%next%>
</table>
</div>
<div id="Layer2"><a href="../index.html" target="_self">[点此返回首页]</a></div>
<div id="Layer3">睁胡仿
<form id="form1" name="form1" method="post" action="">
<p>
<table id="table_bg" height="100%" width="100%" border="1" align="center">
<%for i=1 to 10%>
<tr align="center" ><td width="20%"align="center">
第<%=i%>题</td><td align="center">
<label>
<input type="radio" name="<%=i%>" value="A" onClick="ChangeColor(<%=i%>)"/>
A</label>
<label>
<input type="radio" name="<%=i%>" value="B" onClick="ChangeColor(<%=i%>)"/>
B</label>
<label>
<input type="radio" name="<%=i%>" value="C" onClick="ChangeColor(<%=i%>)"/>
C</label>
<label>
<input type="radio" name="<%=i%>" value="D" onClick="ChangeColor(<%=i%>)"/>
D</label></td>
</tr>
<%next%>
</table>
</p>
</form>
</div>
<script language="javascript">
function ChangeColor(x){
tabs=document.getElementById("tab")
tab.cells[x-1].style.background = "#00FF00";
}
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:expression(body.clientWidth/3);
top:expression(body.clientHeight/5+body.scrollTop);
width:383px;
height:253px;
z-index:1;
overflow: visible;
left: 421px;
top: 18px;
}
body {
background-image: url(backpicture.gif);
background-repeat: repeat-x;
}
#Layer2 {
position:absolute;
left:463px;
top:397px;
width:468px;
height:28px;
z-index:2;
}
#Layer3 {
position:absolute;
left:82px;
top:expression(body.clientHeight/5+body.scrollTop);
width:333px;
height:404px;
z-index:3;
}
#Layer4 {
position:absolute;
left:826px;
top:114px;
width:157px;
height:77px;
z-index:4;
}
-->
<做敏/style>
<div id="Layer1">
<table height="100%" width="100%" border="1" align="center" id="tab">
<%for i=0 to 5%>
<tr align="center" >
<%for j=1 to 10%>
<%k=i*10+j%>
<%if k mod 10=0 then%>
<td bgcolor="#00FF00" id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>悉纤
<%else%>
<td id="<%=k%>" width="10%" height="10" align="center"><%=k%>题</td>
<%end if%>
<%next%>
</tr>
<%next%>
</table>
</div>
<div id="Layer2"><a href="../index.html" target="_self">[点此返回首页]</a></div>
<div id="Layer3">睁胡仿
<form id="form1" name="form1" method="post" action="">
<p>
<table id="table_bg" height="100%" width="100%" border="1" align="center">
<%for i=1 to 10%>
<tr align="center" ><td width="20%"align="center">
第<%=i%>题</td><td align="center">
<label>
<input type="radio" name="<%=i%>" value="A" onClick="ChangeColor(<%=i%>)"/>
A</label>
<label>
<input type="radio" name="<%=i%>" value="B" onClick="ChangeColor(<%=i%>)"/>
B</label>
<label>
<input type="radio" name="<%=i%>" value="C" onClick="ChangeColor(<%=i%>)"/>
C</label>
<label>
<input type="radio" name="<%=i%>" value="D" onClick="ChangeColor(<%=i%>)"/>
D</label></td>
</tr>
<%next%>
</table>
</p>
</form>
</div>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询