问个简单的问题:Repeater控件怎么用javascript实现他其中一个<li>click事件后改变Repeater控件所有 <li>的样式?有点遍历的味道,谢谢
document.getElementById("Repeater1").items.backgroundColor = "white";
这样不行似乎:(
document.getElementById("Repeater1").items.backgroundColor = "white";
这样不行似乎:(
调试欢乐多
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %><!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ul>
<li onclick="showBg(this)">
asdfasdf
</li>
<li>
asdfasdf
</li>
<li>
asdfasdf
</li>
<li>
asdfasdf
</li>
</ul>
</div>
</form>
</body>
<script type="text/javascript" language="javascript">
function showBg(obj) {
obj.parentNode.style.backgroundColor = "red";
}
</script>
</html>