Hello everyone,

I have the following script:

var text;
<% For i As Integer = 0 To array.GetLength(0) - 1 %>
text += '<a href="#" onclick="Test("<%= array(i, 3)%>"); return false;" ><%= array(i, 1) %></a>&nbsp;'
<% Next %>

<%= array(i, 1) %> is a name of a person
<%= array(i, 3)%> is a unique key(that contains letters and numbers!)

With this I want to fill up a variable that I display on the screen. When one of the names is chosen I want that the function Test is executed.
But I get a syntax error when the variable is filled. I think it has something to do with : onclick="Test("<%= array(i, 3)%>") but I don't know what's the problem.

Can anyone help me?

VV

Hi,

Tried a couple of other things:
When I do the following there is no problem:
text+= '<a href="#" onclick="Test(1); return false;"><%= array(i, 1) %></a>&nbsp;</li>'
When i add a letter i get the error that ')' is expected.
text+= '<a href="#" onclick="Test(1a); return false;"><%= array(i, 1) %></a>&nbsp;</li>'

Thx

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.