|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Creating VBScript command dynamically using ASP passed value
ok this will be the death of me! lol
my ASP code creates a form and an array of chekbox with this statement response.write "<input type='checkbox' name='chkProduct" & Cstr(counter) & "' value='delete'>" all goes well and i also have a button that points to a VBScript function passing one parameter the counter start value so i can loop throught the checkboxs on the client side and determine if checked or not. Ok i can display my command "document.frmProductCart.chkProduct & (Cstr(counter)) & .checked" as a string in alert but cannot make it as a command like it should be, anyone got any pointers ? thx you ahead of time... ![]() I have include the page in question. Sry i have not put any comments in it yet... Last edited by spikedeath : February 8th, 2004 at 06:05 PM. |
|
#2
|
|||
|
|||
|
I figured it out...
the trick was to use the Elements function like so alert document.frmProductCart.elements(counter).checked but be carefull with this as all types inputed in a forma are an element this works for me right now because i only have checkboxs and textboxes and checked function returns nothing on a textbox so it only checks the chkboxes ... get it ? lol this is the code: the chkbox: response.write "<input type='checkbox' name='chkProduct' value='delete'>" the button: response.write "<INPUT TYPE='button' name='cmdDelete' value=' Delete ' onclick='DeleteProduct(" & Session("ProductCount") & ")'>" and the function: sub DeleteProduct(ProductCount) dim counter counter = ProductCount do while counter > 0 if document.frmProductCart.elements(counter).checked then /*code when checked*/ else /*code when false*/ end if counter = counter - 1 loop end sub |
|
#3
|
|||
|
|||
|
sry admin.. theyr an error in the previous code the elements function is an array thuse starting ar 0 and not 1 so a -1 should be place where the counter is inside the loop
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Creating VBScript command dynamically using ASP passed value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|