代码改变世界

css用背景图来替换文字来达到隐藏文字的目的

2016-07-04 18:11 by 改吧, 1282 阅读, 0 推荐, 收藏, 编辑
摘要:根据html代码的不同来分成两大类方法,如下 html代码: <h1 class="replace-indent">hello see</h1> 第一种方法:text-indent .replace-indent{ height:200px; width:200px; background:url( 阅读全文

表单中单选框添加选项和移除选项

2016-07-04 10:43 by 改吧, 1020 阅读, 1 推荐, 收藏, 编辑
摘要:selection添加option并放在最后一项 html代码: <form> <select name="location" id="location"> <option value="beijing1">beijing</option> <option value="shanghai1">sha 阅读全文

mousewheel

2016-06-30 15:10 by 改吧, 309 阅读, 0 推荐, 收藏, 编辑
摘要:判断鼠标往上还是往下滚动 html代码: <div class="div"> </div> css代码: .div{ position:absolute; width:100%; height:120%; border:1px red solid; } js代码: /IE CHORME/ docum 阅读全文

js 的点击事件

2016-06-28 10:30 by 改吧, 432 阅读, 0 推荐, 收藏, 编辑
摘要:<button id="btn">click</button> var btn=document.getElementById('btn'); 第一种: btn.onclick=function(){ alert('hello world'); } 消除事件:btn.onclick=null;//就 阅读全文

js改变css样式的三种方法

2016-06-28 10:09 by 改吧, 12334 阅读, 1 推荐, 收藏, 编辑
摘要:共用代码: <div id="div">this is a div</div> var div=document.getElementById('div'); 第一种:用cssText div.style.cssText='width:250px;height:250px;border:1px re 阅读全文

flex的用途

2016-06-27 10:59 by 改吧, 680 阅读, 0 推荐, 收藏, 编辑
摘要:一、可以利用flex来布局一个div在另一个div里面水平垂直居中 如:html代码: <div class="container"> <div class="box"> </div> </div> css代码: .container{ width:600px; height:400px; bord 阅读全文

clip-path

2016-06-27 10:49 by 改吧, 312 阅读, 0 推荐, 收藏, 编辑
摘要:html代码: <div> <img src="BC0C62C1B1962A8A.jpg"> </div> css代码: img{ clip-path:polygon(50% 0%,100% 50%,50% 100%,0% 50%); -webkit-clip-path: polygon(50% 0 阅读全文

json 对象 数组

2016-06-24 10:51 by 改吧, 766 阅读, 0 推荐, 收藏, 编辑
摘要:一、json写法以及获得其数据的方法 var jsons={ name:'wen', age:12, price:'qq' } console.log(typeof jsons);//object console.log(jsons.name);//wen 二、Array(也是数组) 创建数组方法1 阅读全文

BOM:浏览器对象模型

2016-06-21 11:09 by 改吧, 380 阅读, 0 推荐, 收藏, 编辑
摘要:一、window对象 1.window.screenLeft:你打开的这个浏览器窗口相对于屏幕的左边位置 2.window.screenTop:你打开的这个浏览器窗口相对于屏幕的上边位置 ps:当浏览器窗口铺满整个屏幕时 这两个值都为0 3.console.log(window.innerHeigh 阅读全文

递归函数

2016-06-17 11:03 by 改吧, 411 阅读, 0 推荐, 收藏, 编辑
摘要:递归函数: function factorical(num){ if(num<=1){ return 1; } else{ return num*factorical(num-1); } } factorial(2)//2 这个递归函数就是用函数来调用函数本身,但是这样真的好吗,好 接下来看这里 v 阅读全文