This is not rocket science but I think a handy tip.
After seeing and using the tip here for using action hotspots for an @formula and then extracting the onclick value and using it in JavaScript, I thought of an easier way to do some of the functionality.
The other method is still good for when you need to use a lot of javascript but I use this tip for say a Save button or Cancel. Even opening another form etc etc.
An added bonus!! You also get the groovy finger pointer happening instead of just the mouse arrow!!
Code
Place your picture, button graphic etc on your form. Put all your javascript code in, onMouseOut,onClick etc. if desired.
Highlight your graphic, create an action hotspot and put your @formula in it.
This way you get the javascript functionality and the @formula functionality.
In my example I have a pop-up window to enter some information. I want to save the document in the pop-up, close the pop-up window and change the graphic on the main from a 'cross' to a 'tick'.
Picture -
// "type" is a field on the mainform that holds the value of the associated graphic id
onClick
var name = document.forms[0].type.value;
eval("opener.document." + name + ".src='ok'");
window.close()
onMouseOut
document.forms[0].save.src = "saveoff";
//Using alias of Image Resource
onMouseOver
document.forms[0].save.src = "saveon";
HotSpot (which is over the Picture)
@Command([FileSave])