摘要: move.js 利用jq实现 阅读全文
posted @ 2016-03-06 14:11 mingjixiaohui 阅读(189) 评论(0) 推荐(0)
摘要: <style> #outer{ position: relative; width: 800px; height: 450px; margin: 30px auto 0; overflow: hidden; } #inner{ position: absolute; left: 0; top: 0; 阅读全文
posted @ 2016-03-06 14:09 mingjixiaohui 阅读(324) 评论(0) 推荐(0)
摘要: <style type="text/css"> *{ margin: 0; padding: 0; } #outer{ position: relative; margin: 30px auto 0; width: 800px; height: 450px; overflow: hidden; } 阅读全文
posted @ 2016-03-06 14:04 mingjixiaohui 阅读(882) 评论(0) 推荐(0)
摘要: <style> *{ margin:0; padding:0; } #outer{ width:800px; height:450px; overflow:hidden; position:relative; } #inner{ position:absolute; width:4800px; ov 阅读全文
posted @ 2016-03-06 14:01 mingjixiaohui 阅读(178) 评论(0) 推荐(0)
摘要: <style> *{ margin:0; padding:0; } ul{ list-style:none; overflow:hidden; } ul li{ width:100px; height:40px; border:1px solid black; float:left; text-al 阅读全文
posted @ 2016-03-06 14:00 mingjixiaohui 阅读(563) 评论(0) 推荐(0)
摘要: <style> #mainBox{ overflow:hidden; position:relative; width:320px; height:568px; background:url(images/background_1.png) no-repeat; margin:30px auto 0 阅读全文
posted @ 2016-03-06 13:59 mingjixiaohui 阅读(368) 评论(0) 推荐(0)
摘要: <script type="text/javascript"> // var person1 = new Object(); // person1.name = "syz"; // person1.age = "26"; // person1.say = function(){ // alert(" 阅读全文
posted @ 2016-03-06 13:57 mingjixiaohui 阅读(141) 评论(0) 推荐(0)
摘要: 面向对象的语言有一个标志,即拥有类的概念,抽象实例对象的公共属性与方法,基于类可以创建任意多个实例对象,一般具有封装、继承、多态的特性!但JS中对象与纯面向对象语言中的对象是不同的,ECMA标准定义JS中对象:无序属性的集合,其属性可以包含基本值、对象或者函数。可以简单理解为JS的对象是一组无序的值 阅读全文
posted @ 2016-03-06 13:56 mingjixiaohui 阅读(174) 评论(0) 推荐(0)
摘要: <script> window.onload = function(){ var oTxt= document.getElementById("txt1"); var oBtn = document.getElementById("btn1"); oBtn.onclick = function(){ 阅读全文
posted @ 2016-03-06 13:49 mingjixiaohui 阅读(190) 评论(0) 推荐(0)
摘要: <script> window.onload = function(){ var oTxt1 = document.getElementById("txt1"); var oTxt2 = document.getElementById("txt2"); var oBtn = document.get 阅读全文
posted @ 2016-03-06 13:48 mingjixiaohui 阅读(408) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2016-03-06 13:47 mingjixiaohui 阅读(297) 评论(0) 推荐(0)
摘要: //search substring(start,end)截取字符串 slice(start,end)不包括end substr(start,length)后一个参数是长度 charAtvar str ='adfasdf'; //search查找的事下标 // alert(str.search('a 阅读全文
posted @ 2016-03-06 13:46 mingjixiaohui 阅读(203) 评论(0) 推荐(0)
摘要: 账号:<input type="text" id="username" /> 密码: <input type="password" id="pwd" /> <input type="checkbox" name="check" id="check" value=""/> 记住账号密码 <input 阅读全文
posted @ 2016-03-06 13:26 mingjixiaohui 阅读(289) 评论(0) 推荐(0)
摘要: <script> function setCookie(name,value,iDay) { var oDate = new Date(); oDate.setDate(oDate.getDate()+iDay) document.cookie = name +'='+ value +';expir 阅读全文
posted @ 2016-03-06 13:22 mingjixiaohui 阅读(169) 评论(0) 推荐(0)
摘要: <style type="text/css"> *{ margin:0; padding:0; } div{ float:left; } </style> 初始版 <script type="text/javascript"> var oBody = document.getElementsByTa 阅读全文
posted @ 2016-03-06 13:17 mingjixiaohui 阅读(357) 评论(0) 推荐(0)
摘要: <li>0000000</li> <li>11111111</li> <li>22222222</li> <li>33333333</li> script type="text/javascript"> var aLi = document.getElementsByTagName("li"); / 阅读全文
posted @ 2016-03-06 13:08 mingjixiaohui 阅读(503) 评论(0) 推荐(0)
摘要: <script> // var x = 0 ; // function a(){ // x++; // } // a();//没有结果 x++ // a();//没有结果 x++ // console.log(x);//2 // function a(){ // var x = 0; // x++; 阅读全文
posted @ 2016-03-06 13:04 mingjixiaohui 阅读(193) 评论(0) 推荐(0)
摘要: <script type="text/javascript"> window.onload = function(){ var oInp = document.getElementById("inp"); oInp.onclick = function(){ //获取text中的数据 // ajax 阅读全文
posted @ 2016-03-06 12:48 mingjixiaohui 阅读(422) 评论(0) 推荐(0)
摘要: ajax("get","1.get.php","username=jh&password=123",function(data){ // alert(data); var data = JSON.parse(data); }); // function ajax(method,url,data,fn 阅读全文
posted @ 2016-03-06 12:39 mingjixiaohui 阅读(170) 评论(0) 推荐(0)
摘要: *{ margin:0; padding:0; } #outer{ width:1000px; margin:0 auto; overflow:hidden; } #outer div{ width:250px; float:left; } #outer div img{ width:220px; 阅读全文
posted @ 2016-03-06 12:36 mingjixiaohui 阅读(237) 评论(0) 推荐(0)
摘要: <input type="text" id="inp"/> <ul id="wdList"> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""& 阅读全文
posted @ 2016-03-06 11:48 mingjixiaohui 阅读(351) 评论(0) 推荐(0)
摘要: <script type="text/javascript"> // var value = 0; // createRequest(); // function createRequest(){ // if(XMLHttpRequest){ // var xhr = new XMLHttpRequ 阅读全文
posted @ 2016-03-06 11:45 mingjixiaohui 阅读(151) 评论(0) 推荐(0)
摘要: ajax封装 function ajax(method,url,type,fn){ // if(XMLHttpRequest){ // var xhr = new XMLHttpRequest(); // }else{ // var xhr = new ActiveXObject("Microsof 阅读全文
posted @ 2016-03-06 11:42 mingjixiaohui 阅读(165) 评论(0) 推荐(0)
摘要: 1.event 事件 function move(ev){ var oEvent = ev || event;  //前者ie     后者event是ff 谷歌 }   attachEvent添加绑定事件ie支持    addEventListener兼容其他浏览器 var oDiv = docu 阅读全文
posted @ 2016-03-06 11:37 mingjixiaohui 阅读(241) 评论(0) 推荐(0)
摘要: div{ width:100px; height:100px; background:red; } <div></div> <script type="text/javascript"> var oDiv = document.getElementsByTagName("div")[0]; oDiv 阅读全文
posted @ 2016-03-06 11:21 mingjixiaohui 阅读(255) 评论(0) 推荐(0)
摘要: <script type="text/javascript"> // a = 0;//全局变量 // function test(){ //// var a = 1;//局部变量 // a = 1; // alert(a); // } // test(); // var a = 0; // func 阅读全文
posted @ 2016-03-06 11:18 mingjixiaohui 阅读(144) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2016-03-06 11:17 mingjixiaohui 阅读(254) 评论(0) 推荐(0)
摘要: function stopProp(e){ var event = event||window.event;//前者event兼容非ie 后者兼容ie //阻止冒泡 if(event.stopPropagation){ event.stopPropagation() }else{ event.can 阅读全文
posted @ 2016-03-06 11:13 mingjixiaohui 阅读(154) 评论(0) 推荐(0)
摘要: <div id="outer"> <div id="middle"> <div id="inner"></div> </div> </div> #outer{ width:400px; height:400px; background:red; overflow:hidden; } #middle{ 阅读全文
posted @ 2016-03-06 11:07 mingjixiaohui 阅读(263) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2016-03-06 11:04 mingjixiaohui 阅读(122) 评论(0) 推荐(0)
摘要: var oDiv = document.getElementsByTagName("div")[0]; // oDiv.onclick = function(){ // alert(1); // } // oDiv.ondblclick = function(){ // alert(1); // } 阅读全文
posted @ 2016-03-06 11:03 mingjixiaohui 阅读(224) 评论(0) 推荐(0)
摘要: console.log(Math.PI);//圆周率常量 // console.log(Math.sqrt(4));//开平方 // console.log(Math.min(24,13,5235,55));//取最小值 // console.log(Math.max(24,13,5235,55)) 阅读全文
posted @ 2016-03-06 11:01 mingjixiaohui 阅读(158) 评论(0) 推荐(0)
摘要: var oDate = new Date(); // console.log(oDate); // console.log(oDate.getFullYear());//年份 // console.log(oDate.getMonth());//月份 0-11 // console.log(oDat 阅读全文
posted @ 2016-03-06 11:00 mingjixiaohui 阅读(240) 评论(0) 推荐(0)
摘要: jq实现 阅读全文
posted @ 2016-03-06 10:56 mingjixiaohui 阅读(161) 评论(0) 推荐(0)
摘要: var json = { // name:"tom&jerry", // age:"77" // } // var json1 = { // "name":"tom&jerry", // "age":"77" // } //// alert(json.name); // alert(json1.name); //json是一种在后台常用的数据存储... 阅读全文
posted @ 2016-03-06 10:53 mingjixiaohui 阅读(203) 评论(0) 推荐(0)
摘要: var arr = [1,2,3]; // var arr1 = arr.push(5,6); //push返回的是新数组长度 // alert(arr1); // alert(arr); // console.log(typeof[1,2,3]); // var arr2 = [4,5]; // 阅读全文
posted @ 2016-03-06 10:52 mingjixiaohui 阅读(207) 评论(0) 推荐(0)
摘要: var oString = "hello world"; // var num = 3; // var oNum = num.toString(); // alert(typeof(oNum)); // alert(oString.length); // alert(oString.charAt(4 阅读全文
posted @ 2016-03-06 10:51 mingjixiaohui 阅读(149) 评论(0) 推荐(0)
摘要: 在JavaScript中数据类型有:number boolean string function null undefiend object //isNaN 判断的是数据是否是数字 是的话返回false 不是返回true // var b = "a123b"; // var a = parseInt 阅读全文
posted @ 2016-03-06 10:50 mingjixiaohui 阅读(177) 评论(0) 推荐(0)
摘要: <style> /* body 有外边距 margin div 没有默认的样式 p 有外边距margin ul 有外边距 margin 和 左填充 padding-left; li 有默认列表符号 ol 有外边距margin 和 左填充 padding_left; li 有默认列表符号 dl 有外边 阅读全文
posted @ 2016-03-06 10:06 mingjixiaohui 阅读(189) 评论(0) 推荐(0)
摘要: function stopPro(e) { if (e && e.stopPropagation) { //W3C取消冒泡事件 e.stopPropagation(); } else { //IE取消冒泡事件 window.event.cancelBubble = true; } }; 阅读全文
posted @ 2016-03-06 00:20 mingjixiaohui 阅读(147) 评论(0) 推荐(0)
摘要: JS获取class的方法一: 普通版: <script type="text/javascript">function getByClass(oParent, sClass){ var aEle=oParent.getElementsByTagName('*'); var aResult=[]; v 阅读全文
posted @ 2016-03-06 00:20 mingjixiaohui 阅读(294) 评论(0) 推荐(0)
摘要: <script type="text/javascript">//哪个元素//哪个样式 function getStyle(obj, attr){ if(obj.currentStyle)//在火狐中为alert(obj.currenStyle)为undefined是假 假的话就会执行else中 { 阅读全文
posted @ 2016-03-06 00:20 mingjixiaohui 阅读(757) 评论(0) 推荐(0)
摘要: 如果想同时执行多个函数,可以将这些函数放入一个数组中,然后在onload事件里循环数组并执行,或者使用另一个方便的函数addLoadEvent: function addLoadEvent(func) { var oldonload = window.onload; if (typeof windo 阅读全文
posted @ 2016-03-06 00:20 mingjixiaohui 阅读(178) 评论(0) 推荐(0)
摘要: 绑定事件 addEventListener:W3C标准写法IE不兼容 attachEvent:兼容IE 注意:1:事件名不同:IE下要加“on“,W3C不加 2:加载事件的执行顺序不同,W3C按绑定事件的顺序来执行,而IE6,7是后绑定的时间先发生 3:this的指向,W3C中,绑定函数中的this 阅读全文
posted @ 2016-03-06 00:20 mingjixiaohui 阅读(207) 评论(0) 推荐(0)
摘要: javascript: function addClass(id,new_class){ var i,n=0; new_class=new_class.split(","); for(i=0;i<new_class.length;i++){ if((" "+document.getElementBy 阅读全文
posted @ 2016-03-06 00:19 mingjixiaohui 阅读(259) 评论(0) 推荐(0)
摘要: IE、Safari、Opera和Chrome支持innerText属性。Firefox虽然不支持innerText,但支持作用类似的textContent属性。textContent是DOM3级规定的一个属性,而且也得到了safari、opera和Chrome的支持。为了确保跨浏览器兼容,有必要想下 阅读全文
posted @ 2016-03-06 00:19 mingjixiaohui 阅读(203) 评论(0) 推荐(0)
摘要: function getvl(name) { var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i"); if (reg.test(location.href)) return unescape(RegExp.$2.repla 阅读全文
posted @ 2016-03-06 00:19 mingjixiaohui 阅读(261) 评论(0) 推荐(0)
摘要: <div id="b">bbbbbbbbb</div> <div>dddddd</div> JavaScript window.onload=function(){ var a =document.createElement("span"); var b =document.createTextNo 阅读全文
posted @ 2016-03-06 00:19 mingjixiaohui 阅读(219) 评论(0) 推荐(0)
摘要: window.onload=window.onresize=window.onscroll=function() { showImg(); }; function getPos(obj) { var l=0; var t=0; while(obj) { l+=obj.offsetLeft; t+=o 阅读全文
posted @ 2016-03-06 00:19 mingjixiaohui 阅读(200) 评论(0) 推荐(0)
摘要: function toDuble(n){ if(n<10){ return '0'+n; }else{ return ''+n; } } 阅读全文
posted @ 2016-03-06 00:18 mingjixiaohui 阅读(205) 评论(0) 推荐(0)
摘要: function ajax(url, fnSucc, fnFaild) { //1.创建 if(window.XMLHttpRequest) { var oAjax=new XMLHttpRequest(); } else { var oAjax=new ActiveXObject('Microso 阅读全文
posted @ 2016-03-06 00:18 mingjixiaohui 阅读(191) 评论(0) 推荐(0)
摘要: 一:navigator.userAgent window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,通过这个属性来判断浏览器类型,下面是我写的一个函数,这个函数返回一个包含浏览器名称和版本的数组。 此函数可区分ie5.5~ie8、Chrom 阅读全文
posted @ 2016-03-06 00:18 mingjixiaohui 阅读(191) 评论(0) 推荐(0)
摘要: //获取元素的样式值。 function getStyle(elem, name) { if (elem.style[name]) { return elem.style[name]; } else if (elem.currentStyle) { return elem.currentStyle[ 阅读全文
posted @ 2016-03-06 00:18 mingjixiaohui 阅读(225) 评论(0) 推荐(0)
摘要: function getElementsByAttribute(attribute, attributeValue){var elementArray = new Array();var matchedArray = new Array();if (document.all){elementArra 阅读全文
posted @ 2016-03-06 00:10 mingjixiaohui 阅读(251) 评论(0) 推荐(0)
摘要: 制定document.getElementByClassName() Abstract W3C DOM有制定document.getElementByClassName(),但有候没有ID,而只有class name可抓怎?Introduction Blog做改造,常遇到根本有ID可抓,而只有cla 阅读全文
posted @ 2016-03-06 00:07 mingjixiaohui 阅读(1094) 评论(0) 推荐(0)
摘要: 在给网页加一些特效时经常要在<body>中加入“onload”事件,即在网页加载完后执行某事件,例如:<body onload=”alert(‘欢迎光临!’)”,但这样做有个大的缺陷,事件会在网页完全下载完后才会执行,包括网页中的图片或Flash等,如果网页中的图片比较大或有很多图,可能还没等网页完 阅读全文
posted @ 2016-03-06 00:00 mingjixiaohui 阅读(304) 评论(0) 推荐(0)