peterdoherty
Well-known member
- Joined
- Feb 24, 2003
- Messages
- 49
Hi there I am trying to use the following javascript function with ASP code in it . The problem is that the ASP variable j never gets incremented. Can anyone spot the problem? Is there anyway that I can use the javascript variable i in the aspcode (the lstGroupMembers.Items(j).Text()) to select the next item in the list box each time the loop is iterated ?
Help will be greatly appreciated.
Peter
Help will be greatly appreciated.
Peter
Code:
<script language="javascript">
function ReturnGroup()
{
<% Dim j
Dim sName
Dim x
j=0 %>
//Loop around and all all the groups members to the selected text box
var i;
for (i=0; i< <%=lstGroupMembers.Items.Count()%>; i++)
{
//Get just the email address from the list
<%
x = Right(lstGroupMembers.Items(j).Text(), len(lstGroupMembers.Items(j).Text())- InStr(lstGroupMembers.Items(j).Text(), "("))
sName = Left(x, (Len(x)-1))
%>
window.opener.document.forms[GroupEMail].elements[<%=Page.Request.QueryString("Caller")%>].value = window.opener.document.forms[GroupEMail].elements[<%=Page.Request.QueryString("Caller")%>].value + <%= sName %> + <%=j%>, ;
<% j=j+1 %> // THIS SEEMS TO BE ONLY EXECUTED ONCE NO MATTER HOW MANY TIMES THE JAVA LOOP IS ITERATED
}
}
</script>