Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting from an Array

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB

Hi, I am trying to delete an element in an Array. By specifying the code to be executed in the Onclick event of a hyperlink. However the code does delete the last element entered into the Array when the form loads and also on the onClick event? Does anyone know the reason. I thought the code would only be executed when the button is clicked?

Any ideas greatly appreciated. The code is shown below. This code is implemented in a loop which loops through an Array.



<A
href=&quot;checkout.cfm?delete=#rowCount#&quot; <!---onclick=&quot;#ArrayDeleteAt(session.basket,rowCount)#&quot;--->target=mainFrame>
<IMG border=0 height=28 name=Image2 src=&quot;checkout_files/remove.gif&quot;
width=67></A></TD></TR>
<TR>
 
Does it work when you use this code:

<A
href=&quot;checkout.cfm?delete=#index#&quot; target=mainFrame>
<IMG border=0 height=28 name=Image2 src=&quot;checkout_files/remove.gif&quot;
width=67></A></TD></TR>
<TR>

(where #index# is the index of your loop). Rowcount is a constant which represents the total number of rows, so it will always delete the last record... Even when yoy don't want it to be deleted :) Hope this helps... <webguru>iqof188</webguru>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top