[thelist] please help with this code

Rodrigo Fonseca lists at vega.eti.br
Tue Dec 30 10:12:03 CST 2003


Gary McPherson wrote:
> Zhang, Lingling wrote:
> 
>> Hi,
>>
>> It says there's a syntax error with this code:
>>
>> <script language="JavaScript">
>> function checkIndividualDelete(entry, button)
>> {
>>    if (confirm("Are you sure you want to delete this individual 
>> record?"))
>>            entry.deleteIndividual.value = 1;
>>            entry.deleteIndividualID.value = button.value;
>>            alert("delete:"+form.deleteIndividual.value+"
>> "+entry.deleteIndividualID.value);
>>        response.redirect("dbentry2.asp");
>>    else {
>>        button.checked = false;
>>    }
>> }
>> </script>
>>
>> <form name="entry" ...>
>> ...
>> <input type=radio ... onclick=" checkIndividualDelete(entry, this)">
>> ...
>> <input type=hidden name="deleteIndividual" value=0>
>> <input type=hidden name="deleteIndividualID" value="">
>>
>> </FORM>
>>
>> Could someone please tell me what's wrong with this code?
>>
>> Thanks a lot.
>> LL
>>  
>>
> Firstly, you're missing the braces around your if block.
> 
> Secondly, you're calling Response.Redirect inside client-side 
> Javascript, which is never going to work. You could replace that line 
> with "entry.submit();" (assuming that dbentry2.asp is the page 

Also substitute this:
<input type=radio ... onclick=" checkIndividualDelete(entry, this)">
for this:
<input type=radio ... onclick=" checkIndividualDelete(this.form, this)">

You don't want this to work only on IE, do you?

HTH,

	Rodrigo Fonseca.



More information about the thelist mailing list