jQuery学习记录1
jquery 和 js css里面都是坑呀 this.style.backgroundColor 和 css {background:#8df;} 是冲突的,用了前者,再$(this).addClass("css class name");效果显示不出来。
http://youchenglin.iteye.com/blog/685026
前他的一些内容参见下列代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>a.html</title>
<style type="text/css">
div.content {
width: 300px;
border: 1px solid red;
} .divbox{
height:300px;
width:200px;
background:#ffffff;
border:solid 1px #ccc;
float:left;
margin-right:10px;
}
.divOver{
background:#eff8fe;
border:solid 1px #d2dce3;
} </style>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript">
jQuery (function ()
{
$ ("div.content").click (function ()
{
var $self = $ (this).attr ("id");
var $check = $ ("input#inputid" + $self);
if (!!$check.prop ("checked"))
{
$check.prop ("checked", false);
$ (this).css (
{
"color" : "black"
});
}
else
{
$check.prop ("checked", true);
$ (this).css (
{
"color" : "red"
});
}
}); $(".color").find("tr").each(function(i){this.style.backgroundColor=['#fff','#eee'][i%2]});//一行为白色,一行为灰色 $(".color").find("tr").mouseover(function(){
$(this).css("backgroundColor","#6699CC");
}); $(".color").find("tr").mouseout(function(){
$("tr:even").css("backgroundColor","#fff"); //偶数行的颜色
$("tr:odd").css("backgroundColor","#eee"); //奇数行的颜色
}); //当鼠标滑入时将div的class换成divOver
$('.divbox').hover(function(){
$(this).addClass('divOver');
},function(){
//鼠标离开时移除divOver样式
$(this).removeClass('divOver');
}
); });
</script>
</head>
<body>
<center> <input id="inputid1" type="checkbox" />aa<div class="content" id="1">1111</div>
<div id="results">11</div>
<div id="results2">23</div> <table width="200" border="0" cellspacing="1" bgcolor="#eeeeee" class="color">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<br/><hr/><br/>
</center>
<div id="menu">
<div class="divbox">区块A</div>
<div class="divbox">区块B</div>
<div class="divbox">区块C</div>
</div>
</body>
</html>
jQuery学习记录1的更多相关文章
- jquery学习记录
1.选择器实例 语法 描述 $(this) 当前 HTML 元素 $("p") 所有 <p> 元素 $("p.intro") 所有 class=&q ...
- 2016.8.16 JQuery学习记录
1.$(document).ready(function(){}); 这个函数会在浏览器加载完页面之后,尽快执行: 2.所有的JQuery函数用有个$开始表示,All jQuery functions ...
- jQuery Moblile Demos学习记录Theming、Button、Icons图标,脑子真的不好使。
jQuery Moblile Demos学习记录Theming.Button.Icons图标,脑子真的不好使. 06. 二 / Jquery Mobile 前端 / 没有评论 本文来源于www.i ...
- jQuery Moblile Demos学习记录Panel
jQuery Moblile Demos学习记录Panel 11. 二 / Jquery Mobile / 没有评论 本文来源于www.ifyao.com禁止转载!www.ifyao.com 我就 ...
- 【jQuery】精细学习记录
[jQuery]精细学习记录 基础 基本语法: $(选择器).action(回调函数); $/jQuery //jQuery核心函数 $(选择器) //获得的jQuery对象 jQuery核心 - j ...
- D3.js学习记录【转】【新】
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- JQuery学习笔记——基础选择器
第一篇博客,现在原生安卓需求不大了.招聘的Android工程师都需要附带更多的其他技术.这也是开启我学习前端之路的开端.前端时间看了HTML.CSS等,在界面渲染这一块,就不多记录博客了.现在学习着J ...
- Echarts学习记录——如何去掉网格线及网格区域颜色
关键属性 splitLine和splitArea,可以设置相关的属性 示例代码 <!DOCTYPE html> <html lang="en"> <h ...
- Echarts学习记录——如何给x轴文字标签添加事件
Echarts学习记录——如何给x轴文字标签添加事件 关键属性 axisLabel下属性clickable:true 并给图表添加单击事件 根据返回值判断点击的是哪里 感觉自己的方法有点变扭,有更好办 ...
随机推荐
- Express实现http和https服务
一.介绍Http与Https 概念 HTTP: 超文本传输协议(Hypertext transfer protocol) 是一种详细规定了浏览器和万维网服务器之间互相通信的规则,通过因特网传送万维网文 ...
- POJ 2960 S-Nim<博弈>
链接:http://poj.org/problem?id=2960 #include<stdio.h> #include<string.h> ; ; int SG[N];//S ...
- Redis 四:存储类型之有序集合
有序集合似乎更大的操作是由于加了一个叫做“分子”的东西 事实上就好像普通的数据,只是为这个数据加了一个纯数字的标识, 通过操作这些标识来得到我们想要的数据! 分子可以是整形,也可以是双精度浮点型: = ...
- Silverlight 调用 aspx 相关文件
private void Button_Click_1(object sender, RoutedEventArgs e) { WebClient wb = new WebClient(); wb.D ...
- [转]Linux Ubuntu上架设FTP
Linux Ubuntu上架设FTP http://www.blogjava.net/stonestyle/articles/369104.html 操作系统:ubuntu (GNU/Linux) 为 ...
- EF简单的增删查改
Add /// <summary> /// /// </summary> public void Add() { TestDBEntities2 testdb = new Te ...
- java数据结构和算法------冒泡排序
package iYou.neugle.sort; public class Bubble_sort { public static void BubbleSort(double[] array) { ...
- Qt的QTabelWidget
QTableWidget的用法总结 http://blog.csdn.net/zb872676223/article/details/39959061 [Qt]在QTableWidget中添加QCh ...
- oracle odbc配置
oracle odbc配置 Win7 64位 下安装oracle odbc 不能使用控制面板中 “管理工具”->“数据源(OBDC)”中安装数据源. 而要在“ 运行” 中输入 C:\Windo ...
- Objective-C面向对象(三)
1.类的继承 OC的继承是单继承,每个子类只有一个直接父类 1.1 继承的特点 OC继承的语法 @interface SubClass :SuperClass { //成员变量定义 } //方法定义部 ...