JavaScript in HTML

You can use JavaScript anywhere HTML can be placed by using the standard SCRIPT LANGUAGE tag as shown.

<SCRIPT LANGUAGE="JavaScript">
    code goes here
</SCRIPT>

Mark the code as HTML by selecting it then choosing Text - Pass-thru HTML.

Domino passes the HTML to browsers as is.

Check Render pass through HTML in Notes in the Form or Page Properties box to have the Notes client process the HTML. If you do not check Render pass through HTML in Notes, the HTML appears as plain text. You can hide it using the following formula for Hide paragraph if formula is true:

@ClientType = "Notes"

If you refer to a field, the JavaScript code must follow the field on the form.

You can embed computed fields and computed text in HTML text on a form, subform, or page.

You can place JavaScript in a URL using the javascript: protocol, for example:

<A HREF="javascript:code goes here">prompt</A>

You can run JavaScript from an agent by sending it to the browser as HTML using print statements. For example, in LotusScript:

Print "<SCRIPT LANGUAGE=JavaScript>"
Print "code goes here"
Print "</SCRIPT>"

To run an agent from JavaScript, set the href property of the location object to the URL for opening the agent. The URL can be relative to the current host. For example:

location.href = "/dbname.nsf/agentname?OpenAgent&arg1=val"