Dynamically change background color of a Notes doc

This tip allows you to change background color on the fly by the user choosing the color on the form itself.

Many people know about the $PaperColor field that allows you to change the background of a document. The drawbacks are that you have to close and re-open the document to see the change. Also, you are stuck with the 239 (or so) color numbers. This tip allows you to change it on the fly by choosing the color on the form itself.

  1. First, create a field of color type -- let's call the field DocColor.
  2. Then, below it create a button of JavaScript formula type.
  3. In the code, type the following JavaScript:
    document.bgColor = document.forms[0].DocColor.value.substr (2,6)

This tip will only work in ND6, because of the color field type. The idea could be scaled back to work just with the JavaScript portion, though, to make it work with R5.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Malcolm MacLeod. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on JavaScript for Lotus Notes Domino

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...