- 博客(46)
- 资源 (2)
- 收藏
- 关注
原创 css3编写导航栏
Document *{margin: 0;padding:0;} nav>ul>li>a{color: #ccc;text-decoration: none;} nav>ul{ width: 80%; height: 50px; background: -webkit-linear-gradient(top,#292929,#252525); margin: 0 a
2015-11-17 11:25:08
586
原创 小三角
Document *{margin: 0;padding: 0} .box1{ border-width: 10px; border-style: solid; border-color: red transparent transparent transparent; width: 0; height: 0; } .box1:hover{ transform:
2015-11-13 14:09:33
346
原创 jquery编写弹窗
Document .popup{width: 300px; height: 300px; position: absolute; border: 1px solid red; } #div1{ position: absolute; top:0; right: 0; } $(function(){ $('#btn1').cl
2015-11-12 11:30:17
453
原创 jquery写拖拽
详情参考:妙味课堂原创JavaScript视频教程——事件详解3 Document $(function(){ var disX=0; var disY=0; $('div').mousedown(function(ev){ disX=ev.pageX-$(this).offset().left; disY=ev.pageY-$(this).offset
2015-11-11 22:00:49
325
原创 原生js写tab
Document window.onload=function(){ var otab=document.getElementById('tab'); var oinput=otab.getElementsByTagName('input'); var odiv=otab.getElementsByTagName('div'); for(i=0;i<oinput.leng
2015-11-11 14:55:01
1091
原创 jquery运动
animate()宽高不能设添 px stop() finish() Document .div1{ background: red; width: 100px; height: 100px; } .div2{ background: yellow; width: 50px; height: 50px; } .div3{ backgroun
2015-11-11 09:35:59
441
原创 jquery方法2
parents(): 获取元素所有父节点,参数就是筛选 Document $(function(){ $('.div2').parents().css('background','red');//整个document变红 $('.div2').parents('.div1').css('background','red');//整个div1变红 })
2015-11-10 16:16:55
272
原创 jquery方法1
Document /*jquery里面的一些方法 1.get(0) 2.outerWidth()和offsetWidth一样获取对象width,但是它能获取display:none元素的宽度而offsetWidth不行 3.text()设置或者获取标签文本内容 4.remove()删除标签对象以及对应的事件,detach()只删标签对象 */ $(function(){
2015-11-10 16:15:44
259
原创 $(function(){})与window.onload=function(){}的区别
$(function(){}) ps:dom加载完触发window.onload=function(){} ps:全部元素加载完触发,包括dom和img video等前者的性能更好
2015-11-10 15:36:16
332
原创 inline-block
inline-block①使块元素在一行显示②使内嵌支持宽高③换行被解析④不设置宽度的时候宽度由内容撑开float①使块元素在一行显示②使内嵌支持宽高③不设置宽度的时候宽度由内容撑开(避免换行被解析的缺点)浮动,display,position都能改变标签特性(块级标签,内联标签)
2015-11-09 17:08:47
431
原创 opacity:0-1,filter:alpha(opacity=50)
opacity:0-1 //标准浏览器支持filter:alpha(opacity=50) //IE8及其之下版本使用
2015-11-09 16:10:29
518
原创 内联标签和块标签
内联标签:img,span①同一类型标签并排显示②宽度由内容撑开③不支持宽高(除img标签)④不支持margin,padding块标签:p,div,ol,ul,li
2015-11-09 13:51:08
708
原创 事件监听
attachevent(obj,type)//IE使用addEventListener(obj,type,false)//ff使用, Document function addevent(obj,type,fn){ if(window.attachEvent) { obj.attachEvent('on'+type,fn); }else {
2015-11-09 10:56:27
298
原创 word-break word-wrap
word-break //超出范围文字折行,并排列整齐word-wrap //超出范围文字折行,不排列整齐
2015-11-08 17:24:52
252
原创 javascript中var的作用
如果定义一个变量不加var声明,则这个变量为全局变量 Document (function(){ var a=b=10; })() // alert(a);//a受到var声明,为局部变量 alert(b);//由于b没有var声明,所以b为全局变量
2015-11-08 11:41:16
527
原创 jquery链式操作
Document $(function(){ $('ul').find('li').eq(0).css('background','red').end().eq(1).css('background','green').end().end().html('csqclf').find('li').eq(0).css('background','red'); });
2015-11-07 17:52:08
477
原创 把带横杠的字符串转为驼峰字符串
Document var str='border-bottom-color'; function test(str){ var arr=str.split('-');//返回[border,bottom,color]数组 for(var i=1;i<arr.length;i++){ arr[i]=arr[i].charAt(0).toUpperCase() +arr[i].s
2015-11-07 17:32:16
788
原创 javascript数组操作
push()//尾部添加元素unshift()//头部添加元素pop()//从尾部删除元素shift()//从头部删除元素sort()//数组排序,默认按照字符编码循序排concat( )连接两数组var arr3=arr1.concat(arr2 );返回一个变长的数组
2015-11-06 15:10:01
243
原创 获取样式currentstyle(),getComputedStyle()
odiv.style.width;其中的style只能获取行间样式//行间样式currentstyle()//只能在IE里面用getComputedStyle()//只能在FF里用,第一个参数odiv,第二个参数没用随便填
2015-11-06 13:51:52
259
原创 javascript数据类型
Document /*undefined*/ alert(typeof a); /*number*/ var b=12; alert(typeof b); var c='abc'; alert(typeof c); var d=true; alert(typeof d); window.onload=function(){ var obtn=document.g
2015-11-06 09:41:34
222
原创 position定位
子元素使用绝对定位时(position:absolute),父元素必须加上定位属性,一般为相对定位(position:relative)
2015-11-05 16:53:35
306
原创 清除浮动的方法
子元素添加浮动后会对父元素造成影响 清除子元素对父元素的影响:①在main里多添加一个div标签②在父级标签mian样式里overflow:hidden
2015-11-05 16:45:44
276
原创 bom基础
①window.open() Document window.onload=function(){ var obtn=document.getElementById('btn1'); obtn.onclick=function(){ window.open('http://www.baidu.com','_blank'); } }
2015-11-05 13:27:09
286
原创 canvas
Document body{background:black} #canvas{ width: 400px; height: 400px; background: white; } window.onload=function(){ var ocan=document.getElementById('canvas'); var ocan1=ocan.getCon
2015-11-05 10:25:32
272
原创 div随鼠标移动
Document #div1{ width:200px; height: 300px; background: #ccc; position: absolute; } window.onload=function(){ document.onmousemove=function(ev){ var odiv=document.getEleme
2015-11-04 13:44:23
231
原创 document是什么
无标题文档window.onload=function(){ document.onclick=function(){ alert(document.childNodes[1].tagName);//弹出html }}
2015-11-04 11:05:47
397
原创 js正则表达式
两种方式re = new RegExp();re = / /;( perl方式 )方法:search() // 找到匹配字符串的位置;match() //把所有匹配的东西提取出来;元字符 :[ ];\d = [0-9];\w = [a-z0-9_]; //数字,字母,下划线\s 空白字符量词 :个数;+ : 若干;{n} n出现的次数{n,m
2015-11-03 16:53:09
259
原创 jquery动态创建dom节点
Document$(function(){var link = $("csq");$('div:first').append(link);});1234
2015-11-03 13:41:00
313
原创 jquery隐式迭代
Document/*隐式迭代,如果btn1写成btnL的话,浏览器不会报错。友好界面,不方便开发*/// $(function(){// $("#btnl").mouseover(function(){// alert("哈哈");// });// });$(function(){var selector=$("#btn1");if(sele
2015-11-03 13:19:26
888
原创 jquery内置函数
①$.map( )用函数遍历数组中每个元素,有返回值var arr = [3,4,5];var arr2 =$.map(arr,function(num){ return num*2}); alert(arr2);②$.each( ) 无返回值var person = {"张三":23,"李四":34,"王五":33};$.each(person,function(ke
2015-11-03 09:31:16
800
原创 面向对象1
Examples/*属性,变量,函数,方法*/var arr=[12,13,56,34];// alert(typeof arr);var a= 23;// arr.a=4;// alert(arr.a);function show(){ alert(a);}arr.fn=function(){ alert(a)}show();arr.fn();/*原始*/
2015-11-02 10:39:50
195
原创 !important使用
CSS中的!important一般都是用于对低版本的除了iE 6 ,用来做hack的,后面缀上了!important的css语句,让浏览器首选执行这个语句,因为css有继承的样式,加上!importanrt可以覆盖父级的样式。 IE6不认识它的,IE7和别的浏览器中可以用,用来处理浏览器的兼容性,这里写段代码:黄色背景body{background-color:yell
2015-10-26 11:06:30
623
转载 插入排序
插入排序分为直接插入排序和希尔排序 每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子列表当中的适当位置,直到全部记录插入完成为止。 对直接插入排序我的理解就是:先将第一个记录视为一个有序序列,然后依次将后面的记录插入到这个有序序列中来。每次要插入的记录时,须从后往前依次比较有序序列中的记录,直到找到在有序序列中的位置,记录下该位置
2015-10-20 17:10:43
213
原创 C#
冒泡排序:int [ ] array ={78,12,45,67,13,89,10}for(i=0;i{for(j=0;j{if(array[j]{int temp = array[j+1];array[j+1] = array[j];array[j] = temp;}}for(i=0;i{Console.WriteLIne(arr
2015-10-19 13:55:48
265
原创 kendoui分级显示
detailTemplate: kendo.template($("#template1").html()),//显示每行分页 dataBound: function() { // searchBind(); var _this = this; var colcell = $('.k-grid-header .k-hierarchy-cell'); var colal
2015-10-18 15:52:05
660
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人