English 中文(简体)
1. 采用“复合”法
原标题:Initializing "complex" nested javascript/objects

我正在制作一个节目,制作 Java字档案。 我从未与 Java文合作,因此我可能会问一 question问题: 不管怎样,这些 Java字档案都用数据初步输入。

这方面的一个例子是,我开始进入一个包含两个特性的阵列,其中一个包含3个物体。

或者,这至少是想法...... 我是否可以这样做,“M”成为能够正常指数化的真正阵列?

W1[242] = {"W":"authors","M":{ "ArrItem0":{"U":32,"S":4.37},"ArrItem1":{"U":38,"S":4.02},"ArrItem2":{"U":406,"S":1.53} } };
最佳回答
W1[242] = {"W":"authors","M":[ {"U":32,"S":4.37},{"U":38,"S":4.02},{"U":406,"S":1.53} ] };
问题回答

阵列名称如下:

W1[242] = 
    { 
       "W": "authors",
       "M": [{"U":32,"S":4.37}, {"U":38,"S":4.02},{"U":406,"S":1.53}]
    };

取决于你如何与M公司合作。 如果M的每个成分是自己的物体,就可选择。

W1[242] = {"W":"authors","M":[ {"U":32,"S":4.37},{"U":38,"S":4.02},{"U":406,"S":1.53} ] };




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签