Hi,
The Sidebar settings use the AjaxControlToolkit editor, I had not previously tried using scripts in the editor, but when I test I find the same problem as you describe.
Researching it, I found 2 bug reports for the AjaxControlToolkit Editor here and here, so it is a known issue, hopefully it will be fixed in a future version of the editor.
The only workaround I know of is to use IE 8 if you want to edit script in the sidebar because the problem does not happen in IE 8.
Hope it helps,
Joe