More on Dynamic Variables

Results 1 to 2 of 2

Thread: More on Dynamic Variables

  1. #1
    Join Date
    Dec 1969

    Default More on Dynamic Variables

    I had a problem with the fact I needed 11 variables...<BR><BR>searchOp1<BR>searchOp2<BR>sear chOp3<BR>searchOp4<BR>etc.<BR><BR>I was told to use an array, which I have no problem with.<BR><BR>Dim searchOp(11)<BR>For i = 1 to 11<BR>searchOp(i) = Request.Form("searchOp" & i)<BR> If trim(searchOp(i)) = "" Then<BR> searchOp(i) = Request.QueryString("searchOp" & i)<BR> If trim(searchOp(i)) = "" Then<BR> searchOp(i) = "N"<BR> End If<BR> End If <BR>Next<BR><BR>Problem with this is, it creates ...<BR>searchOp(1)<BR>searchOp(2)<BR>etc.<BR><BR>N ormally this doesn&#039;t make a difference, but these are for HTML checkbox names, and I will need to be able to control them with Javascript.<BR><BR>Does anyone know a better way to do the above? Or does anyone know how to get the following to work?<BR><BR>&#060;script language="javascript"&#062;<BR>function uncheckProducts() {<BR> for (var i = 2; i &#060;= 11; i++) {<BR> box = eval("" + i + ")");<BR> if (box.checked == true) box.checked = false;<BR> }<BR>}<BR>&#060;/script&#062;<BR><BR>It doesn&#039;t like the () around the i :-(<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: More on Dynamic Variables

    For javascript arrays, use [] instead of ()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts