guys this is my text box
a. <input type="text" id="val" value="1,23|20,70|40,100|64,120" >

my question is how can i output something like this.?
var chart = [[1,23 ],[20,70],[40,100],[64,120]];

any idea? your help would be greatly appreciated thanx in advance.

Well, reading your post I'm assuming this is your problem:

In Javascript you have an array with values (var chart in your example), which you want to be converted to a string and then to be set as the value of a specific input checkbox. This can be achieved as follows:

var array = [[1,23 ],[20,70],[40,100],[64,120]];

for(var i = 0; i < array.length; i++)
{
    var record = array[i].join();
    array[i] = record;
}

var string = array.join('|');
// String now has the value "1,23|20,70|40,100|64,120"

To set your input's value to be this value, you can use one of the following snippets, depending on if you're using jQuery or not:

// Non jQuery:
document.getElementById('val').value = string;

// jQuery:
$('input#val').val(string);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.