Tip

Rollovers and @formulas, simple

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!!


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])

This was first published in November 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.