C#-WebForm-光棒效果
2024-09-21 09:33:42
<script type="text/javascript">
//获取Repeater的每一行
var oItems = document.getElementsByClassName("item"); //循环为每一行绑定事件
for (var i = ; i < oItems.length; i++) {
//鼠标悬浮时判断背景色
oItems[i].onmouseover = function () {
if (this.style.backgroundColor == "white")
this.style.backgroundColor = "yellow";
}; //鼠标移除时判断背景色
oItems[i].onmouseout = function () {
if (this.style.backgroundColor == "yellow") {
this.style.backgroundColor = "white";
}
}; //点击时事件
oItems[i].onclick = function () {
//将所有行背景色变为白色
for (var j = ; j < oItems.length; j++) {
oItems[j].style.backgroundColor = "white";
}
//将点击的行背景色变为红色
this.style.backgroundColor = "red";
};
} </script>
最新文章
- 如何在Linux上使用文件作为内存交换区(Swap Area)
- .NET (二)委托第二讲:内置委托Func
- 解读Unity中的CG编写Shader系列二
- MFC 打开其他程序
- js小效果-全选
- BZOJ2102 : [Usaco2010 Dec]The Trough Game
- SVM(支持向量机)与统计机器学习 &; 也说一下KNN算法
- Java Concurrency - ReadWriteLock &; ReentrantReadWriteLock
- LA3942-Remember the Word(Trie)
- css 雪碧图 及jquery定位代码
- sql server2008如何创建外键
- 提高你开发效率的十五个Visual Studio 2010使用技巧
- How to initialize a static const map in c++?
- BotVS开发基础—2.3 下市价单 交易
- 【转】C#中判断网址是否有效
- Python随笔--魔法方法(析构与构造)
- window.onload和document.ready
- 【译】Surface中你也许不知道的五件事
- Android工具类-关于网络、状态的工具类
- 前端思想实现:面向UI编程_____前端框架设计开发