JavaScript¶¨ÒåÀàµÄ¼¸ÖÖ·½Ê½
ÌáÆðÃæÏò¶ÔÏóÎÒÃǾÍÄÜÏëµ½À࣬¶ÔÏ󣬷â×°£¬¼Ì³Ð£¬¶à̬¡£ÔÚ¡¶javaScript¸ß¼¶³ÌÐòÉè¼Æ¡·£¨ÈËÃñÓʵç³ö°æÉ磬²ÜÁ¦¡¢ÕÅÐÀÒë¡£Ó¢ÎÄÃû×ÖÊÇ£ºProfessional JavaScript for Web Developers£©Õâ±¾ÊéÖÐÃèÊöµÄ»¹Ëã±È½ÏÏêϸ¡£ÎÒÃÇ¿´¿´JavaScriptÖж¨ÒåÀàµÄ¸÷ÖÖ·½·¨¡£
1£®¹¤³§·½Ê½
javaScriptÖд´½¨×Ô¼ºµÄÀàºÍ¶ÔÏó£¬ÎÒÃÇÓ¦¸ÃÊDZØÐëÕÆÎյģ¬ÎÒÃǶ¼ÖªµÀjavaScriptÖжÔÏóµÄÊôÐÔ¿ÉÒÔÔÚ¶ÔÏó´´½¨ºó¶¯Ì¬¶¨Ò壬±ÈÈçÏÂÃæµÄ´úÂ룺
<script type="text/javascript">
//¶¨Òå
var oCar = new Object();
oCar.color = "red";
oCar.doors = 4;
oCar.showColor = function() {
alert(this.color);
}
//µ÷ÓÃ
oCar.showColor();
</script>
ÎÒÃǺÜÈÝÒ×ʹÓÃoCar¶ÔÏ󣬵«ÊÇÎÒÃÇ´´¾ÍÊÇÏë´´½¨¶à¸öCarʵÀý¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒ»¸öº¯ÊýÀ´·â×°ÉÏÃæµÄ´úÂëÀ´ÊµÏÖ£º<script type="text/javascript">
//¶¨Òå
function createCar() {
var oCar = new Object();
oCar.color = "red";
oCar.doors = 4;
oCar.showColor = function() {
alert(this.color);
}
return oCar;
}
//µ÷ÓÃ
var ocar1 = createCar();
var ocar2 = createCar();
ocar1.color = "black";
ocar1.showColor();
ocar2.showColor();
</script>
˳±ã˵һÏ£¬javaScript¶ÔÏóĬÈϳÉÔ±ÊôÐÔ¶¼ÊÇpublic µÄ¡£ÕâÖÖ·½Ê½ÎÒÃdzÆΪ¹¤³§·½Ê½£¬ÎÒÃÇ´´ÔìÁËÄÜ´´½¨²¢·µ»ØÌض¨ÀàÐ͵ĶÔÏóµÄ¹¤³§¡£
ÕâÑù×öÓеãÒâ˼ÁË£¬µ«ÊÇÔÚÃæÏò¶ÔÏóÖÐÎÒÃǾ³£Ê¹Óô´½¨¶ÔÏóµÄ·½·¨ÊÇ£º
Car car=new Car();
ʹÓÃnew ¹Ø¼ü×ÖÒѾÉîÈëÈËÐÄ£
Ïà¹ØÎĵµ£º
ugmbbc·¢²¼ÓÚ 2009-11-14 09:41:43| 7628 ´ÎÔĶÁ ×ÖÌ壺´ó С ´òÓ¡Ô¤ÀÀ
var ReTitle = '»Ø¸´:Google ÅÅÃûÖÐµÄ 10 ¸ö×îÖøÃûµÄ JavaScript ¿â';
¸ÐлCOMSHARP CMSµÄͶµÝ
ÐÂÎÅÀ´Ô´:tripwiremagazine.com
JavaScript ÊÇ Web ¿ª·¢ÓëÉè¼ÆÖв»¿É»òȱµÄ¶«Î÷£¬²»¹ÜÊÇÒ»¸ö¼òµ¥µÄÍøÒ³»¹ÊÇÒ»¸öרҵµÄÕ¾µã£¬Ò²²»¹ÜÄãÊǸßÊÖ»¹ÊDzËÄñ ......
ÔÚʵ¼ÊÓ¦ÓÃÖУ¬¿ÉÄÜ»áÅöµ½ÕâÑùµÄÇé¿ö£¬ÐèÒªÔÚJava´úÂëÖÐÖ´ÐÐJavaScript¡£
ÀýÈç:
import java.io.IOException;
import java.io.PrintWriter;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public cl ......
ÑÝʾµØÖ·: http://www.wowo-design.com/view/51_01/index.htm
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css²Ëµ¥ÑÝʾ</title>
<style type="text/css">
<!--
*{margin:0;padding:0;border:0;}
body {
......
¾³£»áÔÚjsÀïÓõ½Êý×é,±ÈÈç ¶à¸öÃû×ÖÏàͬµÄinput, ÈôÊǶ¯Ì¬Éú³ÉµÄ, Ìύʱ¾ÍÐèÒªÅжÏÆäÊÇ·ñÊÇÊý×é.
if(document.mylist.length != "undefined" ) {} Õâ¸öÓ÷¨ÓÐÎó.
ÕýÈ·µÄÊÇ if( typeof(document.mylist.length) != "undefined" ) {}
»ò if( !isNaN(document.mylist.length) ) {}
typeof ......
setTimeout (±í´ïʽ,ÑÓʱʱ¼ä)
setInterval(±í´ïʽ,½»»¥Ê±¼ä)
ÑÓʱʱ¼ä/½»»¥Ê±¼äÊÇÒÔºÀÃëΪµ¥Î»µÄ(1000ms=1s)
setTimeout ÔÚÖ´ÐÐʱ,ÊÇÔÚÔØÈëºóÑÓ³ÙÖ¸¶¨Ê±¼äºó,È¥Ö´ÐÐÒ»´Î±í´ïʽ,½öÖ´ÐÐÒ»´Î
setInterval ÔÚÖ´ÐÐʱ,Ëü´ÓÔØÈëºó,ÿ¸ôÖ¸¶¨µÄʱ¼ä¾ÍÖ´ÐÐÒ»´Î±í´ïʽ
set Timeout Ò²¿ÉÒÔʵÏÖÏósetIntervalÒ»ÑùµÄ¹¦ÄÜ
set ......