¡¶JavaScriptºËÐļ¼Êõ¡·
JavaScriptÖеÄÔÐÍ(prototyping) prototypeÊôÐÔ
1.¶ÔÄÚÖöÔÏóµÄÀ©Õ¹
(StringÌí¼Ótrim()·½·¨)
****************
String.prototype.trim = function(){
return(this.replace(/^[\s\xA00+]+/,"").replace(/[\s\xA0]+$/));
}
var strTemp = new String(" a ");
strTemp = strTemp.trim();
****************
(Ö±½ÓÔÚ¶ÔÏóʵÀýÉÏÌí¼Ótrim()·½·¨)
*********************
var strTemp = " a ";
strTemp.trim = function(){...}
*********************
Ö»ÊǸÃÖÖÌí¼ÓÖ®ºóÖ»ÓÐÕâ¸öʵÁ¦Äܹ»·ÃÎÊÐÂÔöº¯Êý.
Ïà¹ØÎĵµ£º
// <!CDATA[
//define
var xmlhttp;
var value=new Array();
var variable=new Array();
//Show Response MSG.
function handleStateChange()
{
var h=document.getElementById("Label1");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
alert(xmlhttp. ......
ÔÎÄ£ºJavaScript - The this keyword
ÔÚ JavaScript ÖÐ this ÊÇ×îÇ¿µÄ¹Ø¼ü×ÖÖ®Ò»¡£ÕâƪÌùÎľÍÊÇÒª¸æËßÄãÈçºÎÓúà this¡£
ÏÂÃæÏȽ²ÈçºÎÔÚevent handling
(ʼþ´¦Àí)ÖÐÓÃËü£¬ÔÙ½Ó×ÅÊǽ² this µÄÆäËûÓ÷¨¡£
ËùÓÐÕß(Owner)
ÏÈÀ´¿´¿´º¯Êý doSomething() ÀïµÄ this ¾¿¾¹Ö¸Ïò(refer to)ÁËʲô£¿
function doSomething() { ......
javascriptµ¥ÒýºÅºÍË«ÒýºÅÇø±ð2009-08-27 10:13ÔÚÒ»¸öÍøÒ³Öеİ´Å¥£¬Ð´onclickʼþµÄ´¦Àí´úÂ룬²»Ð¡ÐÄд³ÉÈçÏ£º
IEÌáʾ³ö´íºó£¬ÔÙÂþ²»¾ÐĵظÄΪ£º
½á¹û»¹Êdzö´í¡£
Õâʱ£¬ÎÒ¾ÍÏ벻ͨÁË£¬ËäÈ»ÎÒÖªµÀ×îÖ±½ÓµÄ½â¾ö·½·¨ÊÇд³ÉÕâÑù£º
µ«ÎªÊ²Ã´javascriptÖеÄתÒå×Ö·û\ûÓÐЧ¹ûÁËÄØ ......
• Сд½ð¶îÓë´óд½ð¶îÁª¶¯
<mce:script language="JavaScript"><!--
function daxie()
{
this.values = ["Áã", "Ò¼", "·¡", "Èþ", "ËÁ", "Îé", "½", "Æâ", "°Æ", "¾Á"];
this.digits = ["", "Ê°", "°Û", "Ǫ"];
}
function daxie.prototype.getdx(num)
{
if(isNaN(num)) return "";
var number = ......
ÔÚһЩ´«Í³µÄСÐÍWEBÓ¦Óÿª·¢¹ý³ÌÖУ¬JavaScriptͨ³£Ö»ÊÇÄÃÀ´×ö±íµ¥ÑéÖ¤¶øÒÔ£¬ËùÒÔÄãºÜÉÙ»áÓöµ½ÒòΪJavaScriptʼþðÅݶøÓ°Ï칦ÄܵÄʵÏÖÇé¿ö£¬ÓÖ»òÕßʼþðÅݶÔ×îÖÕʵÏÖЧ¹ûÓ°Ïì²»´ó£¬¿ÉºöÂÔ¡£È»¶ø£¬ÔÚ½ñÌìһЩ´óÐ͵ÄWEB½»»¥ÏîÄ¿ÖУ¬±ÈÈç´óÐ͵ÄWebGameÏîÄ¿£¬JavaScriptʼþðÅÝÓ°ÏìÊÇÖµµÃÖØÊӵġ£±¾ÎÄͨ¹ýÒ»¸ö¼òµ¥µÄÀý×ÓÀ´½ ......