How to Add the Script

  1. Highlight and copy all script in the shaded area:
     

    <script type="text/javascript" language=JavaScript1.2>

    // This Script adds a Close button (right aligned) to

    // where ever you inserted this script, and sets the focus

    // to the close button. It also performs close when whether

    // Esc or Enter are pressed. The window can be HH or IE based.

      //Do this as document loads

      document.writeln('<OBJECT id="aaHHCtlCloseWin" type="application/x-oleobject" ');

      document.writeln('  classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> ');

      document.writeln('    <PARAM name="Command" value="Close"> ');

      document.writeln('</OBJECT> ');

      document.writeln('<div align="right"><input ID="aaCloseBtn" type="button" value="Close" onclick="aaDoClose();"></div>');

      document.body.onkeypress=CheckClose;

      aaCloseBtn.focus();

      // Close the window

      //

      function aaDoClose(){

        aaHHCtlCloseWin.Click(); }

      // If Esc or Enter Pressed then close the window

      //

      function CheckClose()  {

        if ((window.event.keyCode == 27) || (window.event.keyCode == 13))

          aaDoClose();

        }</script>

  2. Open a topic you wish to add a Close button to.

  3. If you're using RoboHelp HTML, choose Insert: Script and paste the script into the Script dialog box.
    If you're using another editor, switch to HTML mode and paste the script into the <BODY> section.

  4. Preview and test

Back to the beginning of the tip

Kind Regards,

Rob Magrino
Certified XxxxXxxx Instructor
Certified Technical Trainer
Microsoft Certified Professional