I've been playing around with Guys "Creating a custom client side scripting component" in the Snippet Repository
eg. I changed the alert statement to
for(ii=1; ii<3; ii++)
and get "error on page" - any suggestions.