[ÕûÀí]JavaScript×îÁ÷ÐеÄ2ÖÖ¶¨ÒåÀàµÄ·½Ê½
ת×Ô£ºhttp://www.cnblogs.com/greki/archive/2009/06/02/1494863.html
ÆäËü·½Ê½£º¹¤³§·½Ê½£¬¹¹Ô캯Êý·½Ê½£¬ÔÐÍ·½Ê½¶¼¸÷Óи÷µÄ´óȱÏÝ£¬ÕâÀï¾Í²»Ò»Ò»½éÉÜÁË£¬ÏëÁ˽âµÄ¿ÉÒÔÈ¥¿´Ò»ÏÂÕâ±¾Öø×÷µÄµÚ3Õ½ڡ£
1. »ìºÏ¹¹Ô캯Êý/ÔÐÍ·½Ê½
function Car(sColor, iDoors, iMpg) {
this .color = sColor;
this .doors = iDoors;
this .mpg = iMpg;
this .drivers = new Array(“Mike”, “Sue”);
}
Car.prototype.showColor = function () {
alert( this .color);
};
var oCar1 = new Car(“red”, 4 , 23 );
var oCar2 = new Car(“blue”, 3 , 25 );
oCar1.drivers.push(“Matt”);
alert(oCar1.drivers); // outputs “Mike,Sue,Matt”
alert(oCar2.drivers); // outputs “Mike,Sue”
Óŵ㣺¾ßÓÐÆäËü·½Ê½µÄÓÅµã¶øÃ»ÓÐÆäËü·½Ê½µÄȱµã
²»×㣺·â×°ÐÔǷȱ
2 . ¶¯Ì¬ÔÐÍ·½Ê½
function Car(sColor, iDoors, iMpg)
{
this .color = sColor;
this .doors = iDoors;
this .mpg = iMpg;
this .drivers = new Array(“Mike”, “Sue”);
if ( typeof Car._initialized == “undefined”)
{
Car.prototype.showColor = function ()
{
alert( this .color);
} ;
Car._initialized = true ;
}
}
Óŵ㣺·â×°ÐÔ±ÈÉÏÒ»¸ö·½Ê½¸üºÃ
²»×㣺¾ÍÊÇ¿´ÉÏÈ¥Ææ¹ÖÒ»µã£¬ºÇºÇ
×ÜÖ®£¬ÒÔÉÏ2ÖÖ·½Ê½ÊÇĿǰ×î¹ã·ºÊ¹Óõ쬾¡Á¿Ê¹ÓÃËüÃDZÜÃâ²»±ØÒªµÄÎÊÌâ¡£
Ïà¹ØÎĵµ£º
ÔÚJavaScriptÖпÉÒÔ´´½¨ÈýÖÖÏûÏ¢¿ò£º¾¯¸æ¿ò¡¢È·ÈÏ¿ò¡¢Ìáʾ¿ò
¾¯¸æ¿ò¾³£ÓÃÓÚÈ·±£Óû§¿ÉÒԵõ½Ä³Ð©ÐÅÏ¢¡£µ±¾¯¸æ¿ò³öÏÖºó£¬Óû§ÐèÒªµã»÷È·¶¨°´Å¥²ÅÄܼÌÐø½øÐвÙ×÷¡£
Óï·¨£º
alert("Îı¾")
È·ÈÏ¿òÓÃÓÚʹÓû§¿ÉÒÔÑéÖ¤»òÕß½ÓÊÜijЩÐÅÏ¢¡£µ±È·ÈÏ¿ò³öÏÖºó£¬Óû§ÐèÒªµã»÷È·¶¨»òÕßÈ¡Ïû°´Å¥²ÅÄܼÌÐø½øÐвÙ×÷¡£Èç¹ûÓû§µã»÷È·ÈÏ£¬Ä ......
½üÈÕ£¬ÖªÃû¼¼Êõ¿ª·¢ÍøÕ¾SYS-CON ýÌåÁгöÊ®¸öÓ¦ÓÃ×î¹ãµÄjavascript¿ò¼Ü¡£ÎÄÕÂ˵£¬Javascript¿âÒѾ³ÉΪÉè¼ÆÓÅÐãÍøÕ¾µÄ»ù´¡£¬µ±½ñ¼¸ºõËùÓÐÕ¾µã¶¼´øÓÐJavascript»òAjaxÔªËØ¡£ÔÚWeb2.0¿ª·¢´ó³±ÖУ¬ËüÒ²ÐíÊÇ×î¹Ø¼üµÄÒªËØ¡£
ÒÔÏÂÊ®´óJavascript¿ò¼Ü£¬Äã³£ÓÃÆäÖеö?
1. script.aculo.us (http://script.aculo.us/)
......
<script>
function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";",offset);
if(endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset,endstr));
}
function FixCookieDate(data) {
var ba ......
ÐèÒªÒýÈëjquery-1.3.2.js
»ñÈ¡¿í¶È
function getCurrentWidth(){
var currentWidth = 0;
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
var scrollWidth = Math.max(
document.documentElement.scrollWidth,
docu ......
º¯ÊýÊǽøÐÐÄ£¿é»¯³ÌÐòÉè¼ÆµÄ»ù´¡£¬±àд¸´ÔÓµÄAjaxÓ¦ÓóÌÐò£¬±ØÐë¶Ôº¯ÊýÓиüÉîÈëµÄÁ˽⡣
¡¡¡¡javascriptÖеĺ¯Êý²»Í¬ÓÚÆäËûµÄÓïÑÔ£¬Ã¿¸öº¯Êý¶¼ÊÇ×÷Ϊһ¸ö¶ÔÏó±»Î¬»¤ºÍÔËÐеġ£Í¨¹ýº¯Êý¶ÔÏóµÄÐÔÖÊ£¬¿ÉÒԺܷ½±ãµÄ½«Ò»¸öº¯Êý¸³Öµ¸øÒ»¸ö±äÁ¿»òÕß½«º¯Êý×÷Ϊ²ÎÊý´«µÝ¡£ÔÚ¼ÌÐø½²Êö֮ǰ£¬ÏÈ¿´Ò»Ïº¯ÊýµÄʹÓÃÓï·¨£º
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î ......