½øÒ»²½Àí½âjavascript¶ÔÏó¡¢Êý×éºÍ¹þÏ£±í
ÔÚjavascriptÖУ¬¶ÔÏóʵ¼ÊÉϾÍÊÇÒ»¸ö¹þÏ£±í£¬±ÈÈçÏÂÃæÕâ¸öuser¶ÔÏó£º
function user(n, a)
{
this.name = n;
this.age = a;
this.toString = function() {
return "Name:" + this.name + ", Age:" + this.age;
}
}
var u = new user("tom", 18);
for (var k in u) {
alert('key: ' + k + ', value:' + u[k]);
}
ÉÔ×÷¸Ä¶¯£¬Ê¹ÓÃArray¶ÔÏóÀ´´úÌæ¶ÔÏó:
var user = new Array();
user["name"]="tom";
user["age"]=18;
user["toString"]=function(){
return "Name:" + this.name + ", Age:" + this.age;
}
alert(user.toString());
¸ü¼òµ¥µÄд·¨£º
var u = {
"name":"tom",
"age":18
}
u.toString = function(){return 'Name:' + this.name + ', Age:' + this.age;};
alert(u.toString());
ÓÉÒÔÉÏÕâЩ´úÂë¿ÉÒÔ¿´³ö£º
ËùÓеÄjavascript¶ÔÏó,°üÀ¨Array¶ÔÏóÔÚÄÚʵ¼ÊÉϾÍÊÇÒ»¸ö¹þÏ£±í,ÊôÐÔÃû³Æ¾ÍÊǹþÏ£±íµÄkey£¬¶øÊôÐÔµÄÖµ¾ÍÊǹþÏ£±íµÄÖµ¡£
Array¶ÔÏóÓëͨ³£ÒâÒåµÄÊý×é¶ÔÏó²¢²»Ïà¹Ø£¬Í¨³£µÄÊý×é½öÄÜͨ¹ýϱêÀ´¶¨Î»£¬¶øjavascriptÖеÄArrayÈ´¿ÉÒÔÏñ¹þÏ£±íÒ»¸öͨ¹ýkeyÀ´¶¨Î»¼¯ºÏÖеĶÔÏó¡£
¿ÉÒÔ½«Ò»¸öfunctionÖ±½Ó×÷Ϊֵ¸³¸ø¶ÔÏóµÄ“¹þÏ£±í”¡£
ǰ¶Ëʱ¼ä¿´ÁËÈîÒ»·åµÄ ¡¶Êý¾ÝÀàÐÍÓëJson¸ñʽ¡· Ò»ÎÄ£¬Ìáµ½ÔÚyamlÃèÊöÊý¾Ýʱ£¬½«ËùÓеÄÊý¾Ý·Ö³ÉÈýÖÖÀàÐÍ£º
µÚÒ»ÖÖÀàÐÍÊÇscalar£¨±êÁ¿£©£¬Ò»¸öµ¥¶ÀµÄstring»òÊý×Ö£¬±ÈÈ瓱±¾©”Õâ¸öµ¥¶ÀµÄ´Ê¡£
µÚ¶þÖÖÀàÐÍÊÇsequence£¨ÐòÁУ©£¬Èô¸É¸öÏà¹ØµÄÊý¾Ý°´ÕÕÒ»¶¨Ë³Ðò²¢ÁÐÔÚÒ»Æð£¬ÓÖ½Ð×öarray£¨Êý×飩»òList(Áбí)£¬±ÈÈ瓱±¾©£¬¶«¾©”¡£
µÚÈýÖÖÀàÐÍÊÇmap£¨Ó³É䣩£¬Ò»¸ö¼ü/Öµ¶Ô£¨Key/value£©£¬ÓÖ³Æ×÷hash£¨É¢ÁУ©»òdictionary£¨×ֵ䣩£¬±ÈÈç“Ê×¶¼£º±±¾©”¡£
¿ÉÄÜÕâÈýÖÖÀàÐÍÎÒÃǶ¼ºÜÊìϤ£¬µ«ÎÄÖÐÌáµ½µÄ¶ÔjsonµÄËÄÌõ¹æÔòÈ´ÕýºÃÆÊÎöÁËjavascriptÃèÊöÊý¾ÝµÄ·½Ê½:
²¢ÁеÄÊý¾ÝÖ®¼äÓöººÅ£¨“,”£©·Ö¸ô¡£
Ó³ÉäÓÃðºÅ£¨“:”£©±íʾ¡£
²¢ÁÐÊý¾ÝµÄ¼¯ºÏ£¨Êý×飩Ó÷½À¨ºÅ("[]")±íʾ¡£
Ó³ÉäµÄ¼¯ºÏ£¨¶ÔÏó£©ÓôóÀ¨ºÅ£¨“{}”£©±íʾ¡£
ÓÐÁËÕâËÄÌõ¹æÔò£¨ÔÙ¼ÓÉ϶ÔfunctionµÄÀí½â£©£¬¶ÔÓںܶ࿴ÉÏÈ¥·Ç³£“¹îÒ씵Äд·¨£¬¶¼¿ÉÒÔÀí½âÁË¡£Òò´Ë£¬Ò»¸öjavascript¶ÔÏó£¬Êµ¼ÊÉϾÍÊÇÒ»¸öÊý×é»òÊÇÓ³Éä¡£
¹ØÓÚÊý×éÓëÓ³ÉäµÄ²»Í¬£¬¿ÉÒÔ¿´ÏÂÃæÕâ¸öÀý×Ó£º
var m = {
name:"keel",
age:5
}
va
Ïà¹ØÎĵµ£º
var a = document.getElementById("left");
var b = document.getElementById("right");
if(a.scrollHeight < b.scrollHeight)
{
a.style.height = b.scrollHeight+”px”;
} &nb ......
Òý×Ô£ºhttp://blog.csdn.net/lsj19830812/archive/2007/10/25/1843578.aspx
a.jspÊÇÒª´òÓ¡µÄÒ³Ãæ
<html>
<head>
<script language="javascript">
function fmtPrint(printPlace,w,h){
var sarg=new Array();
var sdata=document.all.item(printPlace);
sarg[0]=s ......
Js´úÂë
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="wmp" >
<param name="URL" value="" /> ......
http://www.cnblogs.com/sanshi/archive/2009/07/08/1519036.html
Ò»¡¢sanshi javascript ¼Ì³ÐϵÁУº
1¡¢ JavaScript¼Ì³ÐÏê½â£¨Ò»£© http://www.cnblogs.com/sanshi/archive/2009/07/08/1519036.html
2¡¢JavaScript¼Ì³ÐÏê½â£¨¶þ£©
3¡¢ JavaScript¼Ì³ÐÏê½â£¨Èý£©
4¡¢JavaScript¼Ì³ÐÏê½â£ ......
*˵Ã÷£ºselectÔªËØjavascript³£ÓòÙ×÷
* 1.ÅжÏÊÇ·ñ´æÔÚÖ¸¶¨valueµÄItem
* 2.¼ÓÈëÒ»¸öItem
* 3.ɾ³ýֵΪvalueµÄËùÓÐItem
* 4.ɾ³ýijһ¸öindexµÄÑ¡Ïî
* 5.¸üеÚindexÏîµÄvalueºÍtext
* 6.ÉèÖÃselectÖÐÖ¸¶¨textµÄµÚÒ»¸öItemΪѡÖÐ
* 7.ÉèÖÃselectÖÐÖ¸¶¨valueµÄµÚÒ»¸öItemΪѡÖÐ
* 8.µÃµ½µ±Ç°Ñ¡ÖÐÏîµÄv ......