动态改变 图片的背景颜色
来源:互联网 发布:fpgrowth算法详解 编辑:程序博客网 时间:2024/06/13 00:46
动态改变 图片的背景颜色
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>使用style改变样式</title>
<style type="text/css">
li{
font-size: 12px;
color: #ffffff;
background-image: url(images/bg1.gif);
background-repeat: no-repeat;
text-align: center;
height: 33px;
width:104px;
line-height:38px;
float:left;
list-style:none;
}
</style>
</head>
<script type="text/javascript">
/*
function up(thiss){
thiss.style.backgroundImage='url(images/bg2.gif)';
}
function out(thiss){
thiss.style.backgroundImage='url(images/bg1.gif)';
}
*/
//this 我自己 (当前对象 ) 只上下文关系
window.onload = function(){
var li = document.getElementsByTagName("li");
//循环绑定时间
for(var i=0;i< li.length;i++){
li[i].onmouseover = function(){
this.style.backgroundImage='url(images/bg2.gif)';
this.style.color='red';
}
li[i].onmouseout = function(){
this.style.backgroundImage='url(images/bg1.gif)';
}
}
}
</script>
<body>
<ul>
<li >资讯动态</li>
<li >产品世界</li>
<li >市场营销</li>
</ul>
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>使用className改变样式</title>
<style type="text/css">
li{
font-size: 12px;
color: #ffffff;
background-image: url(images/bg1.gif);
background-repeat: no-repeat;
text-align: center;
height: 33px;
width:104px;
line-height:38px;
float:left;
list-style:none;
}
.out{
background-image: url(images/bg1.gif);
}
.over{
background-image: url(images/bg2.gif);
color:#ffff00;
font-weight:bold;
cursor:hand;
}
</style>
</head>
<script type="text/javascript">
window.onload = function(){
onscroll
var li = document.getElementsByTagName("li");
for(var i=0;i< li.length;i++){
li[i].onmouseover = function(){
this.className="over";
}
li[i].onmouseout = function(){
this.className = "out";
}
}
}
</script>
<body>
<ul>
<li>资讯动态</li>
<li>产品世界</li>
<li>市场营销</li>
</ul>
</body>
</html>
- 动态改变 图片的背景颜色
- 动态改变Gridview单元格的背景颜色
- 动态改变table 背景颜色
- tableView 背景改变 颜色 图片
- 在程序中动态改变控件的背景颜色
- 关于改变窗口背景颜色、图片的研究
- android 动态改变图片颜色
- PB 动态改变菜单背景颜色
- jquery动态改变背景颜色插件
- imagecreatetruecolor背景颜色的改变
- 实现背景颜色的改变
- 改变webView的背景颜色
- 改变 UITableViewHeaderFooterView 的背景颜色
- android 用shape画出来的颜色做背景时,动态改变它的颜色值
- 动态改变Listview的item背景颜色和item中字体的颜色
- 对鼠标移到图片上及离开图片时,图片背景颜色改变的JS实现
- vc对话框添加图片背景及改变背景颜色
- vc对话框添加图片背景及改变背景颜色
- 2016年应届生求职日记
- C#获取机器信息的方法
- redhat7.2修改yum源-以及-yum操作的技巧(xxx.so文件缺失处理办法)
- Android内存优化(使用SparseArray和ArrayMap代替HashMap)
- Python学习(机器学习_多变量线性回归)
- 动态改变 图片的背景颜色
- 机器学习中常见的几种最优化方法
- MyEclipse中的SVN操作手册
- metlab控制摄像头操作笔记(一)基础操作
- 一天连十万字都读不到的人是没有出路的
- 同步与异步、阻塞与非阻塞概念理解
- 字符串匹配和KMP算法
- 一念永恒 > 第520章 黑色光柱!
- Android开发动态的监听网络状态的变化