ITeye博客

JAVASCRIPT

共 51 篇文章

jsonP简单使用

文章源自:http://blog.csdn.net/alen1985/article/details/6365394 介绍JSONP之前,先简单的介绍一些JSON。JSON是JavaScript Object Notation的缩写,是一种轻量的、可读的基于文本的数据交换开放标准。源于JavsScript编程语言中对简单数据结构和关联数组的展示功能。它是仅含有数据对和简单括号结构的纯文本,因此可通过许多途径进行JSON消息的传递。 1. JSONP定义 JSONP是英文JSON with Padding的缩写,是一个非官方的协议。它允许在服务器端生成script tags返回至客户端,通过j…

2013-07-05 17:04 · JAVASCRIPT

详解 JavaScript 中的 this

文章源自:http://www.csdn.net/article/2013-05-08/2815182-javascript-this 详解 JavaScript 中的 this 其实如果完全掌握了this的工作原理,自然就不会走进这些坑。来看下以下这些情况中的this分别会指向什么: 1.全局代码中的this alert(x);// 全局变量x值为2 全局范围内的this将会指向全局对象,在浏览器中即使window。 2.作为单纯的函数调用 function fooCoder(x) { this.x = x; } fooCoder(2); alert(x);// 全局变量x值为2 这里th…

2013-06-28 11:12 · JAVASCRIPT

Lazy Load Image & WordPress Gravatar using JavaScript / JQuery

文章源自:http://viralpatel.net/blogs/lazy-load-image-wordpress-avatar-jquery/ Lazy Load Image & WordPress Gravatar using JavaScript / JQuery Lazy Image Loading After doing all these changes still if you have lots of images on your website, you might want to lazy load these images. Meaning load the imag…

2013-06-19 18:06 · JAVASCRIPT

Deleting Multiple Values From Listbox in JavaScript

文章源自:http://viralpatel.net/blogs/javascript-delete-multiple-values-options-listbox/ Deleting Multiple Values From Listbox in JavaScript There was a requirement of deleting multiple options from a listbox using JavaScript. User can select multiple items from a Listbox. Once the delete button is pres…

2013-06-19 17:56 · JAVASCRIPT

How to convert Javascript Arrays to CSV (Comma separated values)

文章源自:http://viralpatel.net/blogs/convert-javascript-arrays-to-csv/ How to convert Javascript Arrays to CSV (Comma separated values) Let’s see a small code snippet in Javascript that converts JS arrays in Comma separated values. It is also possible to convert an array to delimited text where one can…

2013-06-19 17:10 · JAVASCRIPT

Create ZIP Files in JavaScript

文章源自:http://viralpatel.net/blogs/create-zip-file-javascript/ Create ZIP Files in JavaScript Zip is a very useful file type if I must say most used. It is the most used file format for data compression and archiving. There are number utilities available to create/generate Zip file. Also most of the …

2013-06-19 16:58 · JAVASCRIPT

Create a Clearable TextBox with jQuery

文章源自:http://viralpatel.net/blogs/clearable-textbox-jquery/ Create a Clearable TextBox with jQuery Recently I came across a wonderful article by David Walsh on Clearable Textboxes with Dojo Toolkit [ link ]. This is a simple implementation where a clear button (x) added in a textbox which lets user …

2013-06-19 16:48 · JAVASCRIPT

wbox源码简析

工作常要用到wbox,今天刚好用到,看看源码,其实很简单. (function($){ //class为.wBox_close为关闭 $.fn.wBox = function(options){ // 配置项 var defaults = { wBoxURL: "css/wbox/",// 改变loading.gif图片路径 opacity: 0.5,//背景透明度 callBack: null, noTitle: false, show:false, timeout:0, target:null, requestType:null,//iframe,ajax,img title: "wBo…

2013-06-14 15:50 · JAVASCRIPT

jquery.pagination.js分页插件的运用

插件官方地址: http://plugins.jquery.com/project/pagination 插件js源码 代码 /** * This jQuery plugin displays pagination links inside the selected elements. * * @author Gabriel Birke (birke *at* d-scribe *dot* de) * @version 1.2 * @param {int} maxentries Number of entries to paginate * @param {Object} opts Seve…

2013-06-13 17:00 · JAVASCRIPT

编写高效的JavaScript程序

文章源自: http://www.csdn.net/article/2012-11-14/2811887-writing-fast-memory-efficient-javascript 编写高效的JavaScript程序 一、JavaScript如何在V8中工作? 如果你对JS引擎没有较深的了解,开发一个大型Web应用也没啥问题,就好比会开车的人也只是看过引擎盖而没有看过车盖内的引擎一样(这里将Web网页比如成汽车)。Chrome浏览器是我的优先选择,这里我将谈下V8的核心组件: 一个基本的编译器 ,在代码执行前分析JavaScript、生成本地机器代码而非执行字节代码或是简单的解释,该段…

2013-05-31 17:01 · JAVASCRIPT

Understanding jQuery animate() function

文章源自:http://viralpatel.net/blogs/understanding-jquery-animate-function/ Understanding jQuery animate() function jQuery animate() function is very powerful API to manipulate html elements and add animation functionality. The use of animate function is very simple. First lets check the syntax of this…

2013-05-29 21:16 · JAVASCRIPT

Multiple Checkbox Select/Deselect using jQuery – Tutorial with Example

文章源自:http://viralpatel.net/blogs/multiple-checkbox-select-deselect-jquery-tutorial-example/ Multiple Checkbox Select/Deselect using jQuery – Tutorial with Example Almost all the user interfaces that I have created had this functionality of selecting multiple items from a list to process them or del…

2013-05-29 20:37 · JAVASCRIPT

Dynamically shortened Text with “Show More” link using jQuery

文章源自:http://viralpatel.net/blogs/dynamically-shortened-text-show-more-link-jquery/ Dynamically shortened Text with “Show More” link using jQuery Update: The plugin is now on GitHub: https://github.com/viralpatel/jquery.shorten Facebook user updates has a great functionality. If the comment text is …

2013-05-29 20:37 · JAVASCRIPT

Listbox options javascript select all,move left-right, move up-down

文章源自:http://viralpatel.net/blogs/listbox-select-all-move-left-right-up-down-javascript/ Listbox options javascript select all,move left-right, move up-down While working with Listboxes I had to write few small JavaScript snippets to perform certain tasks like selecting all options / seselecting all…

2013-05-28 11:43 · JAVASCRIPT

Delete Row from HTML Table by clicking it using jQuery

文章源自:http://viralpatel.net/blogs/delete-row-html-table-clicking-using-jquery/ Delete Row from HTML Table by clicking it using jQuery jQuery has became one of the most used and most loved JavaScript framework of all time. It not only does reduce the overhead in coding simple techniques in JavaScript…

2013-05-28 11:43 · JAVASCRIPT

Sum HTML Textbox Values using jQuery / JavaScript

文章源自:http://viralpatel.net/blogs/sum-html-textbox-values-using-jquery-javascript/ Sum HTML Textbox Values using jQuery / JavaScript Here is a small code snippet to sum the values of all textboxes in a form in JavaScript using jQuery. I wrote it for some functionality and thought to share it with yo…

2013-05-28 11:42 · JAVASCRIPT

Mouse Scroll Event Up/Down Example in JavaScript

文章源自:http://viralpatel.net/blogs/javascript-mouse-scroll-event-down-example/ Mouse Scroll Event Up/Down Example in JavaScript The other day I was working on an App that required Google Map like functionality where Mouse Scroll event on an object triggered some action in JavaScript. Handling Mouse W…

2013-05-28 11:42 · JAVASCRIPT

Changing Form Input (Textbox) Style on Focus using jQuery

文章源自:http://viralpatel.net/blogs/change-form-input-textbox-style-focus-jquery/ Changing Form Input (Textbox) Style on Focus using jQuery User experience has always been a factor to be consider while you design a website. Lot of fields such as Human Computer Interface (HCI) and Usability etc have be…

2013-05-28 11:42 · JAVASCRIPT

Create Simplest Accordion Menu using jQuery

文章源自:http://viralpatel.net/blogs/create-accordion-menu-jquery/ Create Simplest Accordion Menu using jQuery Let us create a simple Accordion Menu using jQuery. Accordion Menu are the menu with some animation effect. It has few top line menu items which when clicked toggles to open sub menu options. …

2013-05-27 17:22 · JAVASCRIPT

Default Text Label in Textbox using JavaScript/jQuery

文章源自:http://viralpatel.net/blogs/default-text-label-textbox-javascript-jquery/ Default Text Label in Textbox using JavaScript/jQuery n one of my previous article about Change Form Textbox Style on Focus , we discussed about Usability and HCI issues. Slight change in web pages/input forms can increa…

2013-05-27 17:21 · JAVASCRIPT