I have a windows Dotnet application with a webbrowser Control.
on a button click it calls to a javascript function with parameter and javascript try to convert that received parameter to array. Below is my C# and JavaScript Code
public Form1()
{
InitializeComponent();
webBrowser1.DocumentText = @"<html><head>
<script type='text/javascript'>
function doIt(val)
{
data = String(val);
chartval = new Array(data);
//alert('Method Invoked..................' + data);
for (var i = 0; i < chartval.length; i++)
{
alert('invoked.....'+chartval[i]);
}
return 'i did it!';
}
</script>
</head><body>hello!</body></html>";
}
private void button1_Click(object sender, EventArgs e)
{
string tempstring="[abcd],[efgh],[ijkl]";
string []objarr=new string[1];
objarr[0] = tempstring;
object y = webBrowser1.Document.InvokeScript("doIt", objarr);
MessageBox.Show(y.ToString());
}
here tempstring has thousand values. I want to convert the tempstring value to a javascript array
now I have alert having text
invoked..... [abcd],[efgh],[ijkl]
I want 3 alert with text
invoked..... abcd
invoked..... efgh
invoked..... ijkl
[...]signs for? I don't see any reason here to use them but one, as if you have a 2 dimensional array like[[...],[...],[...]], I think you have just a simple array like["abcd","efgh","ijkl"], please correct me if I'm wrong!