随笔分类 -  js&jquery

1 2 下一页
利用CORS实现跨域请求--转
摘要:原文地址:http://newhtml.net/using-cors/ 跨域请求一直是网页编程中的一个难题,在过去,绝大多数人都倾向于使用JSONP来解决这一问题。不过现在,我们可以考虑一下W3C中一项新的特性——CORS(Cross-Origin Resource Sharing)了。 本文的所有 阅读全文
posted @ 2017-02-22 10:37 一天不进步,就是退步 阅读(3499) 评论(0) 推荐(0) 编辑
js 字符及字符串
摘要:1. 判断是否为null或者空字符var == null var == undefined var == ''2. 字符串及其分割var arr = new Array(); //定义一数组 arr = str.split(" "); //字符分割//arr[0],..... 阅读全文
posted @ 2015-02-10 16:47 一天不进步,就是退步 阅读(231) 评论(0) 推荐(0) 编辑
JS问题Uncaught ReferenceError:XXXX is not defined
摘要:背景:html中一个table,table中进行分页。每行后面有一系列操作,如删除,修改。现在以删除为例说明问题。实现方式:使用button,在onclick中调用js函数,js函数中传递参数如用户ID,用户姓名等。,)">删除报错:Uncaught ReferenceError:XXXX is n... 阅读全文
posted @ 2015-01-21 15:25 一天不进步,就是退步 阅读(15037) 评论(0) 推荐(0) 编辑
javascript中涉及到汉字的比较
摘要:在使用js中的"=="进行字符串的比较时,发现在英文情况下是ok的,但在中文比较时则不行了。在网上搜索,提供了一个解决方法,使用stringObject.localeCompare(target)来解决中文比较问题。string_a.localeCompare(string_b);/* Return... 阅读全文
posted @ 2014-12-16 14:19 一天不进步,就是退步 阅读(5093) 评论(0) 推荐(0) 编辑
javascript-for-loop-example--reference
摘要:We hear a lot about loops, especiallyforloops. So what, in fact, are they? They’re just pieces of code that repeat the same commands several times, un... 阅读全文
posted @ 2014-11-30 17:13 一天不进步,就是退步 阅读(448) 评论(0) 推荐(0) 编辑
jQuery UI Widget(1.8.1)工作原理--转载
摘要:先看下代码的相关注释:/*! * jQuery UI Widget 1.8.1 * * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt)... 阅读全文
posted @ 2014-10-14 15:00 一天不进步,就是退步 阅读(1737) 评论(0) 推荐(1) 编辑
表单提交问题
摘要:HTML DOM Button 对象Button 对象Button 对象代表 HTML 文档中的一个按钮。该元素没有默认的行为,但是必须有一个 onclick 事件句柄以便使用。在 HTML 文档中 标签每出现一次,一个 Button 对象 就会被创建。您可以通过遍历表单的 elements[] ... 阅读全文
posted @ 2014-09-10 15:25 一天不进步,就是退步 阅读(404) 评论(0) 推荐(0) 编辑
Need a code of lazy load for div--reference
摘要:1. For all DIVs of a page$(function() { $("div").lazyload({effect: 'fadeIn'});});2. For a particular DIV having some ID like: some content $(function(... 阅读全文
posted @ 2014-08-19 10:59 一天不进步,就是退步 阅读(147) 评论(0) 推荐(0) 编辑
Preloading an Image with jQuery--reference
摘要:Preloading images will make your application a bit faster by making it lightweight. It is very simple and easy to create and load DOM elements (in thi... 阅读全文
posted @ 2014-08-19 09:34 一天不进步,就是退步 阅读(318) 评论(0) 推荐(0) 编辑
3 Ways to Preload Images with CSS, JavaScript, or Ajax---reference
摘要:Preloading images is a great way to improve the user experience. When images are preloaded in the browser, the visitor can surf around your site and e... 阅读全文
posted @ 2014-08-18 14:47 一天不进步,就是退步 阅读(349) 评论(0) 推荐(0) 编辑
20 Best Drag and Drop jQuery Plugins--reference
摘要:reference from:http://dizyne.net/20-best-drag-drop-jquery-plugins/jQuery has done a great job replacing Flash on websites allowing them to perform fas... 阅读全文
posted @ 2014-05-06 17:05 一天不进步,就是退步 阅读(469) 评论(0) 推荐(0) 编辑
Pass value from child popup window to parent page window using JavaScript--reference
摘要:Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page window using JavaScript.The child popup window must be opened using JavaScript window.open function. And in such case we can access the parent page controls using JavaScript window.opener instance.In this 阅读全文
posted @ 2014-04-08 08:56 一天不进步,就是退步 阅读(404) 评论(0) 推荐(0) 编辑
40 JavaScript Chart and Graph Libraries for Developers--reference
摘要:reference:http://www.egrappler.com/javascript-chart-and-graph-libraries-for-developers/BYTEAMEGRAPPLER· MARCH 4, 2014Graphs and charts are used to simplify complex data and make it easy to read and understand. There is a growing number of Open Source and commercial solutions for pure JavaScript 阅读全文
posted @ 2014-03-10 16:03 一天不进步,就是退步 阅读(1742) 评论(0) 推荐(0) 编辑
jquery学习手记(10)事件简介
摘要:1. 使用jquery监听的方法有许多种:// The many ways to bind events with jQuery// Attach an event handler directly to the button using jQuery's// shorthand `click` method.$( "#helloBtn" ).click(function( event ) { alert( "Hello." );}); // Attach an event handler directly the to button using 阅读全文
posted @ 2013-05-12 10:59 一天不进步,就是退步 阅读(323) 评论(0) 推荐(0) 编辑
jquery学习手记(9)事件基础知识
摘要:1. jquery事件机制提供了两个事件相关的帮助函数:$.fn.hover 提供一个或者两个传入函数参数// The hover helper function$( "#menu li" ).hover(function() { $( this ).toggleClass( "hover" );});$.fn.toggle 提供两个及以上的传入函数参数// The toggle helper function$( "p.expander" ).toggle( function() { $( this ).prev().addClas 阅读全文
posted @ 2013-05-12 10:41 一天不进步,就是退步 阅读(253) 评论(0) 推荐(0) 编辑
js继承的实现(转载)
摘要:原文地址:http://yahaitt.iteye.com/blog/250338js继承有5种实现方式:1、继承第一种方式:对象冒充 function Parent(username){ this.username = username; this.hello = function(){ alert(this.username); } } function Child(username,password){ //通过以下3行实现将Parent的属性和方法追加到Child中,从而实现继承 //第一步:this.method是作为一个临时的属性,并且指向Parent所指向的对象, //第二步:执 阅读全文
posted @ 2013-04-19 07:55 一天不进步,就是退步 阅读(191) 评论(0) 推荐(0) 编辑
jquery学习手记(8)遍历
摘要:层次的级别有:parent/children/sibling。父节点父节点遍历方法有:$.fn.parent(), $.fn.parents(), $.fn.parentsUntil(), and $.fn.closest().示例如下:<div class="grandparent"> <div class="parent"> <div class="child"> <span class="subchild"></span> </div> 阅读全文
posted @ 2013-04-18 22:52 一天不进步,就是退步 阅读(245) 评论(0) 推荐(0) 编辑
jquery学习手记(7)Data_utility_index方法
摘要:Data方法Js对dom元素增加一个属性时,你必须处理一些浏览器内存泄漏的问题。Jquery提供了一个元素保存数据的方法,该方替你管理内存问题。示例:// Storing and retrieving data related to an element$("#myDiv").data( "keyName", { foo: "bar" } );// { foo: "bar" }$("#myDiv").data("keyName");List元素和div建立联系的示例:// S 阅读全文
posted @ 2013-04-18 22:46 一天不进步,就是退步 阅读(246) 评论(0) 推荐(0) 编辑
jquery学习手记(6)CSS, Styling, & Dimensions
摘要:Css方法// Getting CSS properties$("h1").css("fontSize"); // returns a string such as "19px"$("h1").css("font-size"); // also works// Setting CSS properties$("h1").css( "fontSize", "100px" ); // setting an individual proper 阅读全文
posted @ 2013-04-18 22:19 一天不进步,就是退步 阅读(176) 评论(0) 推荐(0) 编辑
jquery学习手记(5)对象
摘要:DOM和DOM元素DOM是html文件的表现层,它包含了很多DOM元素,宏观上来讲,DOM元素可以被认为是web页面的一个片段。DOM的形式有类型如<div>, <a>, 或者 <p>,还有许多属性如:src, href, class 等等。元素的属性类似于js的object。属性是js和页面交换的唯一途径。Jquery对象Jquery对象的优点包括:兼容性---跨浏览器和浏览器版本。例如:var target = document.getElementById("target");target.innerHTML = "< 阅读全文
posted @ 2013-04-18 22:15 一天不进步,就是退步 阅读(208) 评论(0) 推荐(0) 编辑

1 2 下一页