(兼容ff/ie)td点击背景变色特效
.class1{
background:#efefef;
text-align:center;
width:80px;
}
.class2{
background: #ffcc00;
text-align:center;
width: 80px;
}
.class3{
background: #ffffff;
}
.class4{
background: #ffff00;
}
function addEvent(elm, evType, fn, useCapture){
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}
function initTd(){
var sections=document.getElementsByTagName("td");
for(var i=0;i
| a | this is section a |
| b | this is section b |
| c | this is section c |
| d | this is section d |
initTd();
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
相关推荐
-
(兼容ff/ie)td点击背景变色特效
.class1{ background:#efefef; text-align:center; width:80px; } .class2{ background: #ffcc00; text-align:center; width: 80px; } .class3{ background: #ffffff; } .class4{ background: #ffff00; } function addEvent(elm, evType, fn, useCapture){ if (elm.addE
-
jQuery实现表格隔行及滑动,点击时变色的方法【测试可用】
本文实例讲述了jQuery实现表格隔行及滑动,点击时变色的方法.分享给大家供大家参考,具体如下: 运行效果截图如下: 具体代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml&qu
-
兼容FF和IE的动态table示例自写
HTML的table结构如下: 复制代码 代码如下: <table id="Dy_table" width="760" cellpadding="0" style="border-top: solid 1px #9cf" class="tableStyle1" cellspacing="0"> <tr> <th style="width: 40px
-
jQuery轻松实现表格的隔行变色和点击行变色的实例代码
jQuery轻松实现表格的隔行变色和点击行变色的实例代码 <!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> <m
-
Android Button按钮点击背景和文字变化操作
Android 原生的按钮点击状态是有变化的,但是如果是自己加了一个.png格式的图片为背景色,按钮点击就不会有任何效果,为了达到点击按钮有一闪的效果,我们就需要准备两张图进行切换, 而且文字也要变色,老规矩废话不多说直接上代码: 按钮背景图片放在 drawable/background_button.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="h
-
javascript实现点击按钮变色
本文实例为大家分享了javascript实现点击按钮变色的具体代码,供大家参考,具体内容如下 效果如下: 代码如下: 在这个案例中主要用到的是排他思想 html部分 输入我们所需要的按钮个数 <button>按钮1</button> <button>按钮2</button> <button>按钮3</button> <button>按钮4</button> <button>按钮5</butto
-
javascript 兼容FF的onmouseenter和onmouseleave的代码
IE下有 onmouseenter和onmouseleave来解决. 可惜ff就没有. 我再想 , 为什么这么好的功能,为什么ff不引用呢? 还有ie中的onpropertychange ,哎,ff中都没有... 对比例子中引入了一段js ,来兼容FF的onmouseenter和onmouseleave. : 复制代码 代码如下: var xb = { evtHash: [], ieGetUniqueID: function(_elem) { if (_ele
-
js离开或刷新页面检测(且兼容FF,IE,Chrome)
复制代码 代码如下: <!DOCTYPE html><html><head><script> function closeIt() { return "Any string value here forces a dialog box to \n" + "appear before closing the window."; } window.onbeforeunload = close
-
JavaScript实现鼠标点击导航栏变色特效
废话不多说了,直接给大家贴js实现鼠标点击导航栏变色代码,具体代码如下所示: <!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
-
js 操作table之 移动TR位置 兼容FF 跟 IE
js操作table之 移动TR位置 兼容FF 跟 IE var mousePos; function Up_Move(obj){ try{ if(document.all){ document.getElementById('show_input').style.top = mousePos.y document.getElementById('show_input').style.left = mousePos.x }else{ document.getElementById('show_in
随机推荐
- AngularJS日程表案例详解
- AngularJS获取json数据的方法详解
- JS去掉字符串末尾的标点符号及删除最后一个字符的方法
- Python中文件I/O高效操作处理的技巧分享
- CheckBox控件默认选中,提交时永远获得选中状态的实现代码
- BootStrap模态框不垂直居中的解决方法
- javascript中onclick(this)用法介绍
- php时间计算相关问题小结
- android GridView多选效果的实例代码
- Python标准库与第三方库详解
- 被动式统计网站在线人数
- MySQL中无GROUP BY情况下直接使用HAVING语句的问题探究
- 最窄770px最宽1024px的经典布局研究
- Java数据结构及算法实例:考拉兹猜想 Collatz Conjecture
- Android studio 下的APK打包失败问题解决办法
- windows.关于设置脚本的一些基本方法原则
- linux命令详解date使用方法(计算母亲节和父亲节日期脚本示例)
- 彻底解决 webpack 打包文件体积过大问题
- Java 关键字 速查表介绍
- asp.net 数据绑定时对数据列做个性化处理
