??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品无码mⅴ在线观看,亚洲熟女一区二区三区,亚洲精品精华液一区二区
http://m.tkk7.com/jaunt/category/20890.html站在巨h的肩?lt;br>
Flying in the world of Javazh-cnWed, 10 Oct 2007 22:21:24 GMTWed, 10 Oct 2007 22:21:24 GMT60Javascript 如何实现对象的拖动?http://m.tkk7.com/jaunt/archive/2007/10/10/151841.htmlJauntJauntWed, 10 Oct 2007 09:51:00 GMThttp://m.tkk7.com/jaunt/archive/2007/10/10/151841.htmlhttp://m.tkk7.com/jaunt/comments/151841.htmlhttp://m.tkk7.com/jaunt/archive/2007/10/10/151841.html#Feedback0http://m.tkk7.com/jaunt/comments/commentRss/151841.htmlhttp://m.tkk7.com/jaunt/services/trackbacks/151841.html解决思\
q个效果q不常见,通常用于游戏或个人站点中。因为拖x靠鼠标来操作的,
所以对鼠标的位|的捕获是问题的重点Q然后才是根据鼠标的位置讄层的位置?
// 事g操作 function tt_mover() { if(this.lconfig.clicked!=this ) this.set_color(this.config.mover_color); } function tt_mout() { if(this.lconfig.clicked!=this ) this.set_color(this.order?this.config.odd_color:this.config.even_color); } function tt_onclick() { if( this.lconfig.clicked==this) { this.lconfig.clicked=null; this.onmouseover(); } else { var last_clicked=this.lconfig.clicked; this.lconfig.clicked=this ; if(last_clicked) last_clicked.onmouseout(); this.set_color(this.config.onclick_color); } }
</script> </head>
<body> <table bgcolor="#9933ff" align="center" cellpadding="1" cellspacing="0" width="80%"> <tr> <td> <table id="demo" cellpadding="1" cellspacing="1" border="0" width="100%" align="center"> <tr><th colspan="2" bgcolor="ffffff">HTML document object properties</th></tr> <tr><td width="20%">activeElement</td><td>Retrieves the object that has the focus.</td></tr> <tr><td>aLinkColor</td><td>Sets or retrieves the color of all links in the document.</td></tr> <tr><td>bgColor</td><td>Sets or retrieves the background color behe document object.</td></tr> <tr><td>body</td><td>Specifies the beginning and end of the document body.</td></tr> <tr><td>contentEditable</td><td>Sets or retrieves whether the userdocument object.</td></tr> <tr><td>cookie</td><td>Sets or retrieves the string value of a cookie.</td></tr> <tr><td>defaultCharset</td><td>Sets or retrieves the default chara of the document.</td></tr> <tr><td>designMode</td><td>Sets or retrieves whether the document can be edited.</td></tr> <tr><td>documentElement</td><td>Retrieves a reference to the root node of the document.</td></tr> <tr><td>domain</td><td>Sets or retrieves the security domain of the document.</td></tr> </table> </td> </tr> </table> <script language="JavaScript"> anole('demo',1,'#ffffff','#ccccff','#ffccff','#cc99ff'); </script> </body> </html>
From IndexQ?a >http://www.cnitblog.com/yemoo/archive/2006/06/16/12362.html
</style> <script type="text/javascript"> <!-- function addEvent(elm, evType, fn, useCapture) // addEvent and removeEvent // cross-browser event handling for IE5+, NS6 and Mozilla // By Scott Andrew { if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); returntrue; } elseif (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } else { alert("Handler could not be removed"); } }
function externalLinks(){ //讑֮属性rel为external的连接在新页面打开 if(!document.getElementsByTagName) return ; var anchors=document.getElementsByTagName("a"); for(var i=0;i<anchors.length;i++){ anchor=anchors[i]; if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external"){ anchor.setAttribute("target","_blank"); } } }
function onSearchFocus(){ //搜烦框获取焦Ҏ var search=document.getElementById("search"); if(search.value=="误入关键字"){ //如果输入框内Ҏ“请输入关键字”,则清I内容,q设文字颜色ؓ黑色 search.value=""; search.style.color="#000" } } function onSearchBlur(){ //搜烦框失ȝҎ var search=document.getElementById("search"); if(search.value==""){ //如果输入框内容ؓI,则设定文字颜色ؓ灰色Q内容ؓ“请输入关键子?/span>
search.style.color="#999"; search.value="误入关键字" } } addEvent(window,"load",externalLinks) --> </script> </head>
而_style中却没有包括对height的定义,因此element的height样式׃׃Q不是最初所要的l果。要解决q个问题Q可以用反射机制来重写setStyle函数Q?br />function setStyle(_style){ //得到要改变样式的界面对象 var element=getElement(); for(var p in _style){ element.style[p]=_style[p]; } }
]]>JavaScriptQ世界上误解最q语言(转蝲)http://m.tkk7.com/jaunt/archive/2006/11/25/83401.htmlJauntJauntFri, 24 Nov 2006 16:24:00 GMThttp://m.tkk7.com/jaunt/archive/2006/11/25/83401.htmlhttp://m.tkk7.com/jaunt/comments/83401.htmlhttp://m.tkk7.com/jaunt/archive/2006/11/25/83401.html#Feedback0http://m.tkk7.com/jaunt/comments/commentRss/83401.htmlhttp://m.tkk7.com/jaunt/services/trackbacks/83401.html JavaScript:The World's Most Misunderstood Programming Language
JavaScriptQ世界上误解最q语言
Douglas Crockford
译Q袁晓辉
JavaScript, aka Mocha, aka LiveScript, aka JScript, aka ECMAScript, is one of the world's most popular programming languages. Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use. JavaScript's popularity is due entirely to its role as the scripting language of the WWW.
JavaScriptQ或者叫 MochaQ或者叫 LiveScriptQ或者叫 JScriptQ又或者叫 ECMAScriptQ是世界上最行的编E语a之一。事实上世界上的每一C人电脑都安装q在频繁使用臛_一个JavaScript解释器?JavaScript的流行完全是׃他在WWW脚本语言领域中的C军_的?br /> Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented general-purpose programming language. How can this be a secret? Why is this language so misunderstood?
管它很行Q但是很有人知道JavaScript是一个非常棒的动态面向对象通用~程语言。这居然能成Z个秘密!q门语言Z么被误解如此之深Q?br /> The Name 名字
The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. It seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language.
Java- 前缀很容易惛_JavaQƈ认ؓ它是Java的子集或化版的Java。看h最初给它选这个名字是别有用心的,是故意淆概c故意制?误解" 的。JavaScript不是解释执行的Java。Java是解释执行的Java。JavaScript是另外一U语a?br /> JavaScript has a syntactic similarity to Java, much as Java has to C. But it is no more a subset of Java than Java is a subset of C. It is better than Java in the applications that Java (fka Oak) was originally intended for.
JavaScript的语法和Java有相g处,q就像Java的语法和C很相像一栗但是它不是Java的子集,像Java不是C的子集一栗它在JavaQOakQ最初打进军的领域中比Java更好?br /> JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn't confusing enough.
JavaScript不是Sun Microsystems的品,Sun是Java的家。JavaScript是在Netscape被开发出来的。它最初叫LiveScriptQ嗯……还是这个名字好?br /> The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language. But it is really a matter of specialization. Compared to C, JavaScript trades performance for expressive power and dynamism.
-Script后缀让h认ؓ他不是一门真正的~程语言Q和一?~程语言"q有相当的差距。但是这只是应用领域的问题。和C相比QJavaScript是牺牲了性能但换来了丰富的表现力和灵zȝ形态?br /> Lisp in C's Clothing 披着C皮的Lisp
JavaScript's C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.
JavaScript was designed to run in Netscape Navigator. Its success there led to it becoming standard equipment in virtually all web browsers. This has resulted in typecasting. JavaScript is the George Reeves of programming languages. JavaScript is well suited to a large class of non-Web-related applications
JavaScript最初被设计成在Netscape Navigator中运行,它在Navigator中的成功引领它成Z实上所有web览器的标准装备。这造就?cd转换"。JavaScript 是编E语a中的 George ReevesQ超人)Q是大量非webE序的称职之选?br /> Moving Target Ud?br /> The first versions of JavaScript were quite weak. They lacked exception handling, inner functions, and inheritance. In its present form, it is now a complete object-oriented programming language. But many opinions of the language are based on its immature forms.
JavaScript的最初几版非常弱Q没有异常处理,没有内部函数和ѝ现如今Q它已经成ؓ完全面向对象的编E语a。但是这门语a的许多思想是基于它不成熟的形式的?br /> The ECMA committee that has stewardship over the language is developing extensions which, while well intentioned, will aggravate one of the language's biggest problems: There are already too many versions. This creates confusion.
No programming language is perfect. JavaScript has its share of design errors, such as the overloading of + to mean both addition and concatenation with type coercion, and the error-prone with statement should be avoided. The reserved word policies are much too strict. Semicolon insertion was a huge mistake, as was the notation for literal regular expressions. These mistakes have led to programming errors, and called the design of the language as a whole into question. Fortunately, many of these problems can be mitigated with a good lint program.
没有什么编E语a是完的。JavaScript也有它设计上的错误,比如重蝲?号随着cd的不同既表示"相加"又表C?q接"Q和本该避免的有错误們?with 语句。它的保留字{略q于严格。分L插入是一个巨大的错误Q比如作为字面正则表辑ּ的符h。这些失误已直接D~程中的错误Q也使这门语a的整体设计遭疑。还好,q些问题中有许多都可以在良好?lint E序中得以缓解?br /> The design of the language on the whole is quite sound. Surprisingly, the ECMAScript committee does not appear to be interested in correcting these problems. Perhaps they are more interested in making new ones.
q门语言的整体设计(上的问题Q是相当明显的。奇怪的是ECMAScript委员会ƈ没有对修正其中存在的问题表现出太大的兴趣Q也总们更热衷于制造新的问题?br /> Lousy Implementations p糕的实?br /> Some of the earlier implementations of JavaScript were quite buggy. This reflected badly on the language. Compounding that, those implementations were embedded in horribly buggy web browsers.
JavaScript的一些早期实现有许多bugQ这反过来对语言本n产生了很坏的影响。更p糕的是q些满是bug的实现是嵌入在满是bug的web览器中的?br /> Bad Books p糕的书
Nearly all of the books about JavaScript are quite awful. They contain errors, poor examples, and promote bad practices. Important features of the language are often explained poorly, or left out entirely. I have reviewed dozens of JavaScript books, and I can only recommend one: JavaScript: The Definitive Guide (4th Edition) by David Flanagan. (Attention authors: If you have written a good one, please send me a review copy.)
几乎所有的JavaScript书都是相当可怕的。它们包含错误,包含不好的例子,q׃好的做法?JavaScript语言的一些重要特性它们要么没有解释清楚,要么Ҏ没有提及。我看过很多JavaScript的书Q但我只能推荐一本:David Flanagan著的 JavaScript: The Definitive Guide (4th Edition) Q《JavaScript权威指南 W四版》)。(作者们h意:如果你们写出了好书请发给我一份副本,我给你们校对。)
Substandard Standard “准标准”的标准
The official specification for the language is published by ECMA. The specification is of extremely poor quality. It is difficult to read and very difficult to understand. This has been a contributor to the Bad Book problem because authors have been unable to use the standard document to improve their own understanding of the language. ECMA and the TC39 committee should be deeply embarrassed.
ECMA公布的官方语a规范的质量极其的差。不仅难读而且极其难懂。它可ؓ那些"p糕的书"做出了不的贡献Q因为那些作者无法通过q个标准文档来更深地理解q门语言。ECMA和TC39应该为此感到非常尬?br /> Amateurs 业余?br /> Most of the people writing in JavaScript are not programmers. They lack the training and discipline to write good programs. JavaScript has so much expressive power that they are able to do useful things in it, anyway. This has given JavaScript a reputation of being strictly for the amateurs, that it is not suitable for professional programming. This is simply not the case.
Is JavaScript object-oriented? It has objects which can contain data and methods that act upon that data. Objects can contain other objects. It does not have classes, but it does have constructors which do what classes do, including acting as containers for class variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented inheritance.
JavaScript是面向对象的吗?它有对象Q它的对象可以包含数据以及对数据q行操作的方法,对象也可以包含其他的对象。它没有c,但是它有构造函数来做类的事情,包括声明cȝ变量和方法。它没有面向cȝl承Q但是他有面向原型的l承?br /> The two main ways of building up object systems are by inheritance (is-a) and by aggregation (has-a). JavaScript does both, but its dynamic nature allows it to excel at aggregation.
构徏对象pȝ的两大主要方法是l承Qis-aQ和聚合Qhas-aQ。这两者JavaScript都有Q但是它的动态天性允许有比聚合更好的实现方式?br /> Some argue that JavaScript is not truly object oriented because it does not provide information hiding. That is, objects cannot have private variables and private methods: All members are public.
But it turns out that JavaScript objects can have private variables and private methods. (Click here now to find out how.) Of course, few understand this because JavaScript is the world's most misunderstood programming language.
但是事实是JavaScript 的对象可以有U有变量和私有方法(点击q里来看如何实现Q。当Ӟ之所以很有人知道这个是因ؓJavaScript是世界上误解最q语言嘛?br /> Some argue that JavaScript is not truly object oriented because it does not provide inheritance. But it turns out that JavaScript supports not only classical inheritance, but other code reuse patterns as well.
另一些关于JavaScript不是真的面向对象的争论其理由是它没有提供l承。但是事实是JavaScript不但支持l典的承,而且支持其他一些代码重用的模式?br /> Copyright 2001 Douglas Crockford. All Rights Reserved Wrrrldwide.版权所?lt;?gt;
var xObject = new Boolean(false); var yObject = new Boolean(true);
此时我们声明了一?font color="#0000ff">Boolean对象QBoolean对象是对Boolean值的一个封装?br />Boolean对象Q一个gؓtrue或false的Boolean对象?br /> 原始的Boolean值和Boolean对象是有区别的,不要怺hQ引?font color="#0000ff">Core JavaScript 1.5 Reference中的一句话Q?/font>
Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object.