现在我已经在谷歌上搜索了很多东西,但是我似乎找不到我想要的东西.我不是在谈论确实会下拉菜单的options对象,我是在谈论看到
Now I have googling this a lot, but I cant seem to find what I am looking for. I am not talking about the options object that does drop down menus, I am talking about seeing stuff like
options.remove, options.enable, options.instance,说实话,我不确定我要弄清楚的代码是否已经创建了一个称为"options"的对象,或者它是否是一个预先构建的javascript对象.在我的Dreamweaver编辑器中它会亮起紫色,因此我感觉到它是一个预先构建的对象.我是新来的,对不起.
To be honest, I am not sure if the code I am trying to figure out already created some object called "options" or if its a pre-built javascript object. It lights up purple in my dreamweaver editor so I have a feeling its a pre-built object. I am new, sorry.
推荐答案options对象是传递给提供配置信息的方法(通常是构建jQuery小部件或类似方法的方法)的对象.
An options object is an object passed into a method (usually a method that builds a jQuery widget, or similar) which provides configuration info.
通常使用对象文字表示法声明选项对象:
An options object is usually declared using object literal notation:
var options = { width: '325px', height: '100px' };有效的选项取决于您所调用的方法或窗口小部件.选项对象没有什么特殊"之处,使其与任何其他javascript对象都不同.上面的对象文字语法给出与以下结果相同的结果:
The options that are valid depend on the method or widget that you are calling. There is nothing 'special' about an options object that makes it different from any other javascript object. The object literal syntax above gives the same result as:
var options = new Object(); options.width = '325px'; options.height = '100px';示例:
$( ".selector" ).datepicker({ disabled: true }); //create a jQuery datepicker widget on the HTML elements matched by ".selector", //using the option: disabled=true更多推荐
在Javascript中,选项对象是什么?
发布评论