Then you can't do that on the client side.
You need set some kind of flag or variable to tell your server to run code to delete the records.
Test the flag on the server.
Run the code to delete the records.
Load th epage again.
I have added an example below to illustrate the process.
Note that the first time the page is loaded request("deleteAll") will be empty and the code wont run.
<% @language = "vbscript" %>
'Test the flag
if request("deleteAll") = "YES" then call DeleteAllRecords
var agree = confirm("Are you sure you want to do this?");
//Set the flag to YES if confirmed
<form name="form1" method="POST">
<input type="button" onclick="checkAll()" value="Check All">
<input type="hidden" name="deleteAll" value="NO">
'VBScript code goes here to delete records
Response.write("All Records Deleted")
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.