background preloader

Javascript 2

Facebook Twitter

Ajax 1

Html. Ajax 2. Chris Casciano's Place Name Here: What Does X-UA-Compatible. So here I am a couple weeks after the IE team announced through a variety of different channels their proposal to help cushion the blow of their next browser release through the use of a META declaration and HTTP header, “X-UA-Compatible” describing what browser(s) the page and its associated styles and javascript files target. I’ve got plenty of thoughts on why vendor extensions and related adjustments to behavior are bad. I also have some concerns over this one in particular. Extensions, and more general workarounds and hacks of all kinds [vendor driven or not] get buried into code, reused, copy and pasted, dropped in application templates, removed by accident, and generally used by people who don’t know why they’re doing it, but instead just because it works.

For the moment I want to focus on the practical — what does the additional rendering mode and the ability to switch to it via META declaration mean to me as a working web developer? Right Now With IE8 in our sights After IE8 hits. 300+Jquery, CSS, MooTools 和 JS的导航菜单. 如果你是网站前端开发人员,那么对你来说,也许做一个漂亮导航菜单会很得心应手。 但今天我要为大家总结各种导航菜单的资源,以便让大家的网站前端开发的工作更方便更快速,只要选择现成的例子就可以应用于自己的网站了。 我收集的这些资源,从非常简单的HTML和CSS导航菜单,到非常复杂和高级的JQuery、JavaScript和MooTools技术,这都可以让你轻松实现褪色、滑动、拖动等效果。 如果你是网站前端开发人员,那么对你来说,也许做一个漂亮导航菜单会很得心应手。

但今天我要为大家总结各种导航菜单的资源,以便让大家的网站前端开发的工作更方便更快速,只要选择现成的例子就可以应用于自己的网站了。 译者注:您还可以参考以下前端开发相关教程&资源:《精选15个国外CSS框架》《10个非常棒的Ajax及Javascript实例资源网站》《Web前端开发必备手册下载》《精选30个优秀的CSS技术和实例》《15个前端开发/网页设计师必备的Bookmarklet》 《12种Javascript解决常见浏览器兼容问题的方法》 1.Fancy menu - 非常酷的导航菜单: 2. 下载 dock 菜单 3.37个不同的CSS导航菜单技术: 4.这个导航五年前就有了,但现在看来依然很棒! 5.漂亮的JQuery滑动效果菜单,有四种不同的例子。 6.更新jquery嵌套标签设置,有演示; 7.垂直JavaScript菜单,含子菜单效果。 8.13个精选纵向及横向CSS菜单 9.各种不同的CSS菜单教程 10.很全的收集CSS纵向菜单的网站:dynamicdrive.com 11.CSSplay.com,一个非常全面的收集各种CSS菜单的网站,而且经常有更新,推荐! 12.有显示/隐藏效果的菜单 - 有 CSS 和 MooTools两种; 13.Superfish v1.4.8 – jQuery 菜单插件 14.方便的图片标签翻转菜单; 15.模仿Digg.com风格的CSS纵向菜单 16.JavaScript可折叠菜单,查看演示 17.独特的使用jQuery和MooTools的导航菜单; 查看演示 18.CSSmenumaker.com - 提供专业的CSS菜单; 19. 20. 21. jdMenu 多层次菜单插件 , jQuery框架 - 纵向多级下拉菜单列表 22. 23.折叠风格JQuery菜单 24. 25. jQuery树插件 下载.

Js兼容来自蓝色理想 - Sam Lin. 在线编辑器 兼容Firefox,IE Demo - 梦幻之旅. 完美实现HTML在线编辑器回车单换行_绿豆牙的黑豆牙. Iframe编辑器问题..._luck star. JSINQ playground. Painfully Obvious → JavaScript. Javascript Array Fun - Rick Strahl's Web Log. A commenter – Josh - pointed out a small error in some code I posted a while back regarding a CSS property watcher component that can monitor changes in any CSS property and notify you by firing a function. The jQuery plug-in code keeps track of CSS properties and values in an array and whenever the properties monitored change an event is fired to let the event consumer know of the change and take appropriate action based on the change.

My error in the code relates to how the array was declared which was: The intent was to create an empty array of the specified length, but that’s of course not what happens. It’ll create an array of 1 element with the length as a value. Vals: new Array(props.split(",").length) $.each(data.props, function(i) { data.vals[i] = el.css(data.props[i]); }); This code loops through the properties array and creates the array on the fly simply by setting the indexer of the vals array which is created dynamically.

Specifcally Javascript arrays auto-size just like this: JavaScript多线程编程简介. 虽然有越来越多的网站在应用AJAX技术进行开发,但是构建一个复杂的AJAX应用仍然是一个难题。 造成这些困难的主要原因是什么呢? 是与服务器的异步通信问题? 还是GUI程序设计问题呢? 通常这两项工作都是由桌面程序来完成的,那究竟为何开发一个可以实现同样功能的AJAX应用就这么困难呢? AJAX 开发中的难题 让我们通过一个简单的例子来认识这个问题。 Function ( id ) { var a = getArticle(id); document.writeln(a.name + "" + a.content); } 然而你也许会注意到,重复用同一个文章ID调用此函数,需要与服务器之间进行反复且无益的通信。 Var cache = {}; function getArticleWithCache ( id ) { if ( ! 现在已将读入的文章缓存起来,让我们再来考虑一下函数backgroundLoad(),它应用我们上面提到的缓存机制加载所有文章信息。 Function backgroundLoad ( ids ) { for ( var i=0; i < ids.length; i++ ) { var a = getArticleWithCache(ids[i]); backgroundLoad(a.children); } } backgroundLoad ()函数接收一个ID数组作为参数,然后通过每个ID调用前面定义过的getArticldWithCache()方法,这样就把每个ID对应的文章缓存起来。

到目前为止,一切似乎看起来都很完美。 如果在这个单线程环境里进行同步通信会发生什么事情呢? 如上所述,既然同步通信在使用中会造成如此严重的问题,JavaScript就把异步通信作为一条基本原则。 Var cache = {}; function getArticleWithCache ( id, callback ) { if ( ! 这个程序也在内部调用了getArticle()函数。 单是上面这些改动你可能已经认为相当复杂了,但是对backgroundLoad()函数做得改动将会更复杂,它也要被改写成可以处理回调函数的形式: 改动后的backgroundLoad()函数看上去和我们以前的那个函数已经相去甚远,不过他们所实现的功能并无二致。 造成这些问题目的根本原因是什么呢?

试试多线程编程. 08年 ,JavaScript总结 - Java - JavaEye新闻. Jacob Seidelin 在他的博客中写道: “2008年真是太棒了,不仅仅是因为很多厉害的人物在使用JavaScript和新的canvans元素,浏览器厂商也在竞争,试图超越对方在JavaScript方面的表现,这都证明了JavaScript的重要性。 以下是我的总结: Games 对于JavaScript游戏来说这一年很伟大。 使用DHTML和基于Canvas的游戏似乎有能力来接管Flash的一些领域。 许多经典的游戏都被重新的设计:Super Mario , Pac-Man (YUI pacman:很酷的YUI JavaScript库游戏), Breakout , Space Invaders , Bomberman 和 T&C Surf Designs 。 还有很多在经典的旧游戏上加入了他们的新思想:Matt Hackett创作的 Spacius , Mark Wilcox 创作的 Invaders from Mars , VertigoProject创作的 RedLine Racing 和 Tetris game 。 我们甚至还看到了一些角色扮演的游戏:Andrew Wooldridge创造的Tombs of Asciiroth 和 CanvasQuest ,Pierre Chassaing创造的ProtoRPG。 2008年还出现了一些有趣的JavaScript / DHTML游戏库,最突出的就是GameJs (GameJS:超酷的Canvas游戏库)和GameQuery ,后者为jQuery库的扩展。

最后这个很特别, DEFENDER of the favicon,它将旧游戏Defender压缩到了只有16x16的空间。 Demos 越来越多的浏览器开始支持canvas元素,也就是说,在绘制动态图形方面我们又多了一种选择。 今年的大忙人Mathieu 'p01' Henri制作了很多小应用,使用一行代码就能做相当酷的事:Rubber effect ,Tunnex ,Mars ,他们都在256个字节以内! Mathieu Henri 利用canvas元素,在20 lines 比赛 中创造出了惊人的效果: Dynamic Hypnoglow ,Twinkle 和 Hypno Trip Down the Fractal Rug 。 Emulation Graphics Audio. JavaScript Games and Web Games. 写给设计人的10个jQuery特效 - 幸福收藏夹. 最佳的addEvent是怎样诞生的[摘自网络] - A JavaScript Fancier - IT博客网. IE的 JScript 存在内存泄露的bug 想必大家都清楚或者有耳闻了。 这是由于IE的内存回收管理器的一个设计错误导致的。 当我们编写脚本的时候创建了交叉引用,例如如下代码: window.onload = function () { var x = document.getElementsByTagName(’H3’); for (var i=0;i { x[i].onclick = openClose; x[i].relatedElement = x[i].nextSibling; // simplified situation x[i].relatedElement.relatedElement = x[i]; } }或者在函数中使用脚本语言最常见的闭句Closures的时候,IE都无法回收内存。 而闭句在给DOM对象注册事件处理器(event handler)的时候最为常用。 Novemberborn提供了一些example可以让你运行并切实感受到这个bug。 Function addEvent( obj, type, fn ) { if ( obj.attachEvent ) { obj[’e’+type+fn] = fn; obj[type+fn] = function(){obj[’e’+type+fn]( window.event );} obj.attachEvent( ’on’+type, obj[type+fn] ); } else obj.addEventListener( type, fn, false ); } function removeEvent( obj, type, fn ) { if ( obj.detachEvent ) { obj.detachEvent( ’on’+type, obj[type+fn] ); obj[type+fn] = null; } else obj.removeEventListener( type, fn, false ); } QuirkMode 对选择John为胜利者的解释概括来说就是以上代码最简洁有效,在避免内存问题的同时还巧妙的保证了this关键字在ie的attachEvent中能正常工作。

不支持 Netscape 4 和 Explorer 5 Mac。 要做到最好真的好辛苦。 使用javascript修复浏览器中12个常见而又头痛的问题. 使用javascript修复浏览器中12个常见而又头痛的问题,大部分都使用了jQuery的插件来处理的. 我们提倡无论何时都尽可能地使用CSS,这样我们更容易取得成功.现在浏览器对CSS的支持已经非常好,肯定足以让你用来控制你的网页布局与排版.但,即使如此,还是有某些页面元素会在不同的浏览器下表现也不一样. 如果你不了解其中的原由,请不用担心,深入一下CSS的规则并且看一下Using CSS to Fix Anything: 20+ Common Bugs and Fixes这个文章. 如果上面那篇文章对你毫无帮助,你可以使用下面12个javascript解决方案的其中之一去修复你的问题,并使你的页面看起来跨所有浏览器! 在本文中,我们将为你在web应用开发中遇到的最常见的CSS问题提供12个javascript解决方案.

你也许会对其它的CSS相关文章感兴趣. 1. 自从我们抛弃以表格为基础的布局方式,创建视觉上等高的列或内容块就成为了一个挑战. 1.1 使用jquery设置等高 jQuery有个插件可以设置同一个容器内的所有盒子模型的高度相等,而且还可以创建非常简洁的网格--当然,额外的性能开销也是微乎其微的.从可用性与性能的角度来看,使用一个简单的javascript代替会更适合: equalHeights() 这个函数检测同一个容器中所有兄弟节点元素的高度,然后设置每个元素的最小高度为这些元素中高度值最大的那个. 如何运作 equalHeights() 循环指定元素的顶层子节点,并设置它们的最小高度值为最高的节点的高度值. 查看 演示. 1.2 使用jQuery设置等高列 另一个设置等高的jQuery插件 $("#col1, #col2").equalizeCols(); 上面代码设置#col1, #col2列等高 $("#col1, #col2").equalizeCols("p,p");上面代码会设置#col1,#col2等高,并把增加额外空间的元素添加到#col1和#col2下的p元素中去. 2. IE6及早期的版本不支持png图片透明.虽然可以使用一些小窍门令IE5.5或IE6支持png透明,但这不是理想的方式而且难于使用. 2.1 加强IE6使其支持透明 查看演示.源代码下载 2.2. iFixPng improved 查看演示源代码下载 3. 查看演示源代码下载 4. 查看 演示. 5. Javascript的一种模块模式 @ 随网之舞. » CSS Best Practices -- CSS, JavaScript and XHTML Explained. Separate content from presentation in order to make your website accessible to all users and devices, increase the longevity of your website (you won’t have to touch you HTML to alter the page’s layout), and enable the creating of new pages without worrying about consistency of appearance or layout.

(Note that i wrote this in 2004 and posted here in 2007, so some stuff may be archaic). General CSS Rules Build and test your CSS in Firefox (or Safari if you are working on a Mac).Specify units for non-zero values, but not for zero values.Don’t use quotation marks around paths/URLs when setting a background image or loading in an imported fileTry to avoid applying padding/borders and a fixed width to an element. Stylesheet Maintenance Minimize and clean up your cssOrganize your CSS fileThere are pros and cons to using Multiple stylesheets HTML Development General CSS Rules Build and test your CSS in Firefox or Safari if you are working on a Mac. Specify units for non-zero values. Avoid ! ECMAScript Language Binding.

Anonymous function. Anonymous functions originate in the work of Alonzo Church in his invention of the lambda calculus in 1936 (prior to electronic computers), in which all functions are anonymous. In several programming languages, anonymous functions are introduced using the keyword lambda, and anonymous functions are often referred to as lambda functions. Uses[edit] Sorting[edit] When attempting to sort in a non-standard way it may be easier to contain the comparison logic as an anonymous function instead of creating a named function. Most languages provide a generic sort function that implements a sort algorithm that will sort arbitrary objects. This function usually accepts an arbitrary comparison function that is supplied two items and the function indicates if they are equal or if one is "greater" or "less" than the other (typically indicated by returning a negative number, zero, or a positive number). Consider sorting a list of strings by length of the string: Closures[edit] Currying[edit] Map[edit]

Javascript的匿名函数 @ 随网之舞. 一、什么是匿名函数? 在Javascript定义一个函数一般有如下三种方式: 函数关键字(function)语句: function fnMethodName(x){alert(x);}函数字面量(Function Literals): var fnMethodName = function(x){alert(x);}Function()构造函数: var fnMethodName = new Function('x','alert(x);') 上面三种方法定义了同一个方法函数fnMethodName,第1种就是最常用的方法,后两种都是把一个函数复制给变量fnMethodName,而这个函数是没有名字的,即匿名函数。 实际上,相当多的语言都有匿名函数。 二、函数字面量和Function()构造函数的区别 虽然函数字面量是一个匿名函数,但语法允许为其指定任意一个函数名,当写递归函数时可以调用它自己,使用Function()构造函数则不行。 Var f = function fact(x) { if (x < = 1) return 1; else return x*fact(x-1); };Function()构造函数允许运行时Javascript代码动态的创建和编译。 和函数关键字定义相比Function()构造器有自己的特点且要难以使用的多,所以这项技术通常很少使用。 三、匿名函数的代码模式 昨天hedger wang在他的blog介绍了几种匿名函数的代码模式: 错误模式:其无法工作,浏览器会报语法错。

Function(){ alert(1); }(); 函数字面量:首先声明一个函数对象,然后执行它。 这三种方式是等同的,hedger wang因为个人原因比较喜欢第3种,而在实际应用中我看到的和使用的都是第1种。 四、匿名函数的应用 《Javascript的一种模块模式》中的第一句话就是“全局变量是魔鬼”。 您或许有兴趣: Blog Archive » JavaScript中的作用域. » Javascript Switch Statement Quirks -- CSS, JavaScript and XHTM. Javascript: Things you should know Note: This is part II of a "Javascript: Things you should know" series. I assume readers have an understanding of the core language. I try to cover quirks that are important, often lead to logic errors but don’t throw an error, and aren’t covered in most books or tutorials. The previous entry was Browser Detection versus Object Detection. There are three things you may or may not know about the switch statement: there is no datatype conversion , once there is a match, all expressions will be executed until the next break or return statement is executed, and you can include multiple cases for a single block of code.

Data Type is important. Javascipt is generally a loosely typed language. Y = 5; x = '5'; if(x == y){ alert("they're the same"); // this alert will show } The exception is case values in the switch statement. In the above case, there is no match as 5 and ’5′ are not the same datatype. Break or Return statements are necessary.

» 15 JavaScript Gotchas -- CSS, JavaScript and XHTML Explained. We all know that JavaScript can trip you up. Here are a 15 common traps that can trip you up when coding javascript. You likely know most of the code on the page, but if you keep these 15 gotchas in your mind, coding and debugging will be less of a headache: Case Sensitivity Variables and function names are case sensitive. Like mismatched quotes, you already know this. But, since the error may be silent, here is the reminder. Pick a naming convention for yourself, and stick with it. GetElementById('myId') ! Document.getElementById('myId').style.Color; // returns "undefined" Mismatching quotes, parenthesis and curly brace The best way to avoid falling into the trap of mismatched quotes, parentheses and curly brackets is to always code your opening and closing element at the same time, then step into the element to add your code.

Every time you open an element, close it. Conditional statements (3 gotchas) Line Breaks Beware of hard line breaks in JavaScript. Extra commas HTML id conflicts ‘this’ Getting Out of Binding Situations in Jav. Most developers don’t know about—or don’t care enough about—binding in JavaScript. Yet this single issue is responsible for a sizeable portion of the questions on most JavaScript-related support channels, and thousands—if not millions—of hairs being tortured away from developer heads every single day.

Yet with a little attention to this oft-overlooked subject, you can avoid wasting your time, energy, and patience and move on to more powerful, efficient scripting. Why should we care about binding? #section1 Almost no major object-oriented programming (OOP) languages force you to consider binding. PHP and JavaScript do require you to explicitly state which object you’re accessing, even if it’s the current one. Of course, neither PHP nor JavaScript are actually object-oriented in the traditional sense.

In JavaScript, binding is always explicit, and can easily be lost, so a method using this will not refer to the proper object in all situations, unless you force it to. Okay, that’s weird. 正则表达式30分钟入门教程. Javascript Word HTML Cleaner v1.1. This script is designed to clean the html that word outputs of all the extraneous tags that tend to mess up inserting it into a webpage. To use it, save a word document as a web page, and change the type to 'html filtered'. Then copy the source code of the outputted page into the box below. Click 'Clean' to start the conversion process. The cleaned source code will appear in the second box, and a preview of what it looks like will be displayed in the page below.

Please be aware that this cleaner is not perfect, and cannot fix everything that is wrong with word's html. This cleaner has absolutely no warranty, without even the implied warranty of merchantability or fitness for a particular purpose. Depending on the size of the file, the conversion could take awhile. High Performance Web Sites :: Cuzillion. At Web 2.0 Expo today I announce the release of Cuzillion. The tag line is ‘cuz there are zillion pages to check. It’s indispensable for people like me who are always pushing browsers to their limit trying to figure out how to squeeze out a little more performance. I’m constantly thinking of or being asked about how browsers handle different sets of resources loaded in various ways. Before I would open an editor and build some test pages. Firing up a packet sniffer I would load these pages in different browsers to diagnose what was going on.

A great example of how Cuzillion is useful is looking at the impact inline scripts have when they follow a stylesheet in Internet Explorer. But look what happens if we put an innocent inline script between the stylesheet and image: stylesheet, inline script, and image. This was a great discovery. The findings from a tool like Cuzillion are really valuable. Much thanks to Google for letting me release this code under Open Source. TIDE 2.0 beta. S Blog » Blog Archive » 背投广告代码的完善. Regular Expressions As Functions. Cookies. JSMIN, The JavaScript Minifier. jQuery API. A comparison of php json libraries. Firefox与ie 的javascript区别 - jianxiong8814的专栏 - CSDNBlog. 窥探jQuery——面向JavaScript程序员. Developers | Facebook Developers News. Michael J. I. Jackson » Shadowbox.js Media Viewer 1.0 beta. The Elements of JavaScript Style. JavaScript: The World&#039;s Most Misunderstood Programming Lang. GPDE Team Blog : JavaScript Memory Leak Detector.

#143264 - Pastie. New - Pastie. Prototype中文API文档. 使用 Web 标准生成 ASP.NET 2.0 Web 站点 一 - ajax,css,js,javascript,action. 为您提供专业的JavaScript脚本--jsDoc.cn 最全面的脚本语言教程,特效,插件,文档库.