Manage Learn to apply best practices and optimize your operations.

Rollover buttons and @formulas

Here's how to have rollover buttons with @formula behind!

If you ever wanted to create a rollover buttons on your web page, then you probably know that JavaScript code is the only choice you have. But what if you want to have rollover buttons with @formula behind!? Here is how to do it:

If you are reading this tip, then you should know that for the action hotspots (with @formula) Domino generates the _doClick(v, o, t) function. If you look in to the source code of your page then for the action hotspot you will see something like
onClick="return _doClick('e662ee54e6165298852569d7004f3d44/$Body/0.3B2E', this, null)"

So, if we could get the first parameter, then we could reuse it by writing our own _doClick function in the onClick event of our rollover buttons (with the same second and third parameters of course). In other words, on our form we will have the action hotspots that we will hide on web page and use only to retrieve the Domino generated _doClick's first parameter for our own _doClick.
Lets consider an example.

1. On you form create an action hotspot and put some formula behind it.
2. Open the properties for the hotspot and click on the last tab (HTML)
3. In the 'Id' field put some id (for example - ahId01)
4. Using passthru html surround your action hotspot with division tags. Don?t forget to hide it with the style="display:none" as we do not need it to appear on our web page example:
<DIV style="display:none"> .. your action hotspot(s) ... </DIV>

5. Put the following code in to the onLoad event of your form

mystr = new String
mytmp = new String(mystr.slice(editstr.indexOf("'")+1))
mystr = mytmp.slice(0, mytmp.indexOf("'"))

...the purpose of this code is to retrieve the first parameter of the _doClick() function that we will use in our own _doClick for the rollover buttons later on.

6. Now create your rollover buttons. Your code will probably look similar to the following:

<A href="#" onMouseOver="..your onmouseover function.."
onMouseOut="..your onmouseout function.."
onClick="return _doClick(mystr, this, null)"><IMG

Note the first parameter for the _doClick function. As you already guessed, by the time your page is loaded 'mystr' will hold the same value as it was generated by Domino for the action hotspot.

Another advantage of this approach is that later when you need to change your @formula you don't need to worry about anything. Whatever Domino will generate it will always be put in to our "mystr" parameter.

The code works on both IE and Netscape browsers. The only exception for Netscape is that it has to be version 6 (as the earlier versions do not support DOM methods used in this code).

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...