开发者

On Button Click constructing a filling values with new Array

I have this data as shown, on click of a button, is it possible to construct this jsonData with开发者_运维百科 some different data?

var jsonData = [{open:100.01,high:104.06},
        {open:100.02,high:105.06},
        {open:100.03,high:106.06},
        {open:100.04,high:107.06}];

function callMe()
{
}

button onclick= "callMe()";

(Later, I will construct this data from Database, right now I am working with only Front End on JavaScript)


Are you looking for something like this:

var jsonData = [{open:100.01,high:104.06},
        {open:100.02,high:105.06},
        {open:100.03,high:106.06},
        {open:100.04,high:107.06}];

function Clear()
{
    jsonData = new Array();
}

function AddData(open,high)
{
    jsonData.push({'open':open,'high':high});
}

function callMe()
{
    AddData(100.05,108.07);
}

button onclick= "callMe()";

Update:

var jsonData = [{open:100.01,high:104.06},
        {open:100.02,high:105.06},
        {open:100.03,high:106.06},
        {open:100.04,high:107.06}];

function callMe()
{
    jsonData = [{open:100.01,high:104.06}, 
       {open:100.02,high:105.06}, 
       {open:100.03,high:106.06}, 
       {open:100.04,high:107.06},
       {open:100.05,high:108.06},
       {open:100.06,high:109.06}];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜