今天在看jquery.selectboxes的src的时候,发现其addoption可以用以下对象添加
var options = {
"1":"v1",
"2":"v2"
};
在select中显示就是两个value和text分别为1,v1和2,v2的下拉列表项。
很熟悉是不?json格式
定义了一个object,原来js中的property的命名可以是string的,见js权威指南
7.1. Creating Objects
The easiest way to create an object is to include an object literal in your JavaScript code. An object literal is a comma-separated list of property name/value pairs, enclosed within curly braces. Each property name can be a JavaScript identifier or a string, and each property value can be a constant or any JavaScript expression. Here are some examples:
var empty = {}; // An object with no properties
var point = { x:0, y:0 };
var circle = { x:point.x, y:point.y+1, radius:2 };
var homer = {
"name": "Homer Simpson",
"age": 34,
"married": true,
"occupation": "plant operator",
'email': "homer@example.com"
};
利用这个特性,其实可以做为hashtable的简单实现。
分享到:
相关推荐
applet 调用js 所需包 JSObject.getWindow(this).eval("javascript:alert(111)");
Introduction to JavaScript Object Notation - Early Release
Acrobat Forms JavaScript Object Spec Acrobat表单用JavaScript对象规范,PDF表单编程非常有用的资料。
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一个子集...
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。易于人阅读和编写,同时也易于机器解析和生成。它基于JavaScript(Standard ECMA-262 3rd Edition - December 1999)的一个子集。 JSON采用完全独立...
The JavaScript Object Notation (JSON) Data Interchange Format,RFC 8259,
介绍了删除Javascript Object中间的key的方法,然后主要详谈了delete的用法,非常的详尽,给小伙伴们参考下
jsObject.txt
Javascript Object Browser 扩展 点击crx安装
NULL 博文链接:https://shuaigg-babysky.iteye.com/blog/458603
Mastering JavaScript Object-Oriented Programming 2016 | ISBN: 1785889109 | English | 287 pages | PDF | 1.9 MB With this book, we'll provide you with a comprehensive overview of OOP principles in ...
JavaScript中object和Object有什么区别,为什么用typeof检测对象,返回object,而用instanceof 必须要接Object呢 这个问题和我之前遇到的问题非常相似,我认为这里有两个问题需要解决,一个是运算符new的作用机制,...
get-js-object-key-value 返回给定 JS 对象的键和值 应用程序接口 var getKeyValue = require('get-js-object-key-value') getKeyValue(对象: JSObject ) JSObject可以是具有一个或多个属性的对象 返回 一个...
JavaScript Object Programming 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传...
Javascript Object Oriented Programming 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请...
This brief book explains the advantages of the object model, inheritance, both classical and prototypical, and shows how these concepts can be implemented in JavaScript. It also shows how object ...
Learn to build scalable server application in JavaScript using Node.js Generate instances in three programming languages: Python, JavaScript, and C# Work with a combination of access modifiers, ...