Hi,
I found some script on the net that will update a text field with the values from selected checkboxes. It stores the value between pages and wil remove items if the users unchecks a box.
I am very poor with JavaScript and keep getting an error saying object expected.
Can anyone see an obvious issue with the following code?
Thanks for any help.
JavaScript
Checkboxes, displayed through ASP pulling records from the database.
Text field
I found some script on the net that will update a text field with the values from selected checkboxes. It stores the value between pages and wil remove items if the users unchecks a box.
I am very poor with JavaScript and keep getting an error saying object expected.
Can anyone see an obvious issue with the following code?
Thanks for any help.
JavaScript
Code:
Dim myvalue
function mytester(myvalue,myname){
tester='document.getElementById("'+myname+'").checked'
if (eval(tester)){
if (document.mailerlookup.compareitems.value==''){
document.mailerlookup.compareitems.value=','+myvalue+','
}
else{
document.mailerlookup.compareitems.value = document.mailerlookup.compareitems.value+myvalue+','
}
}
else{
document.mailerlookup.compareitems.value = document.mailerlookup.compareitems.value.replace(','+myvalue+',', '');
}
}
Checkboxes, displayed through ASP pulling records from the database.
Code:
Response.Write("<tr><td bgcolor='" & strBGColour & "'><input type='checkbox' id='checkbox1863' name='checkbox1863' value='" & objRS("uniqueid") & "' onClick='javascript:mytester(this.value,this.name)' /></td><td bgcolor='" & strBGColour & "'>" & objRS("contact") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("rooms_from") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("idstatus") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("price_from") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("price") & "</td></tr>")
Text field
Code:
<input type="text" name="compareitems" />