This is really more of an ActiveX question than a JavaScript one so you may want to try a forum that covers that.
I do see a number of issues, but I do not know if any of them are the problem.
First off the alert is being called because it is in the catch block. Some exception is being thrown causing the field value to not be set and causing the code in the catch block to execute instead.
Secondly the attributes in your HTML tags need to be surrounded by quotes. Third there is a semicolon in your input tag that should not be there.
The tags should look like this:
- <SCRIPT type="text/javascript">
- <INPUT id="Button1" onclick="EditRecord()" type="button" name="Command0" />
Fouth the line below has a number of problems. All the attribute values need quotes. I do not see "event" or "for" as valid attributes for the script tag in any DOM documentation. Even if they are in IE how would you ever have an onclick event on a script tag. It is not rendered on the page and can not be clicked on.
- <SCRIPT language=javascript event=onclick for=Command0>
Last but not lest what you are trying to do is ex termly unsafe. I would be very surprised if IE will let you run this code by default even in the local zone. So you will probably have to lower your IE security setting all the way for this code to run.