(兼容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
随机推荐
- 用htc实现进度条控件
- Windows10下MySQL5.7.19安装教程 MySQL忘记root密码修改方法
- swift3.0网络图片缓存原理简析
- H5上传本地图片并预览功能
- VBS教程:函数-GetRef 函数
- 浅析Java设计模式编程中的单例模式和简单工厂模式
- Java关键字final、static使用总结
- Python标准库之itertools库的使用方法
- c++运算符重载基础知识详解
- PHP连接MySql闪断自动重连的方法
- JS FormData上传文件的设置方法
- 浅谈javascript函数式编程
- 在js里怎么实现Xcode里的callFuncN方法(详解)
- 基于JavaScript 下namespace 功能的简单分析
- C#数据库操作的用法
- java 中OkHttp的使用方法及实例
- 深入浅析java web log4j 配置及在web项目中配置Log4j的技巧
- Android中通过访问本地相册或者相机设置用户头像实例
- 使用C++制作简单的web服务器
- PHP VS ASP