(兼容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
随机推荐
- PHP简单实现二维数组赋值与遍历功能示例
- Flex弹出窗口请求Action函数示例
- 心情不好时做这25件事
- PostgreSQL安装、配置及简单使用方法
- 解析jquery easyui tree异步加载子节点问题
- vue实现动态数据绑定
- Eclipse中导出码云上的项目方法(图文教程)
- javascript 利用arguments实现可变长参数
- javascript基于HTML5 canvas制作画箭头组件
- Python 比较两个数组的元素的异同方法
- 深入认识JavaScript中的函数
- 如何在Flash中处理Cookies?
- vue插件vue-resource的使用笔记(小结)
- js实现GridView单选效果自动设置交替行、选中行、鼠标移动行背景色
- js和jquery设置disabled属性为true使按钮失效
- 记录滚动条位置(使用userdate)
- Android 对话框 Dialog使用实例讲解
- Linux中 CentOS 6.5 手动升级gcc到gcc-6.1.0
- android 获取文件的扩展名和去掉文件扩展名的小例子
- Python httplib模块使用实例