Referencing the session applet

Manipulate the Reflection session through its API methods and properties by referencing the named session applet from your JavaScript code.

For example, a JavaScript line that displays the About box for the applet above would look like this:

var api = document.IBM3287.getAPI("JSAPI","IBM3287");
   api.showDialog( "aboutBoxDialog" );

You could also perform the same task in JavaScript using the document's applets[] property, which is an array of the applets in the document (use this technique if the applet's name contains spaces or punctuation characters):

document.applets["IBM3270Applet"].getAPI("JSAPI","IBM3270").showDialog( "aboutBoxDialog" );

If you don't name an applet, you can reference it in JavaScript by its index in the applets[] array, like this:

   // If the Reflection applet is the only one on the page, its index
   // in the applets[] array is 0.
   document.applets[0].getAPI("JSAPI","IBM3270").showDialog( "aboutBoxDialog" );

HINT:Because the Reflection for the Web API is intended primarily for scripting logon tasks, it is recommended that you set all of your other Reflection session configuration options using the Manage Sessions panel. Then, in the web pages that you use to launch the Reflection session, script only those tasks needed to perform the logon.