|
JavaScript Control
Among the Dynamix parameters, there's a CloseOnExit parameter which determines whether the menu closes when the mouse moves out of it. It's a fundamental behavior characteristic, and you may feel that your choice won't suit all users of your site. For this reason, we've added a public method to Dynamix which you can address via JavaScript. This way, you can add a form checkbox to the page containing Dynamix to toggle the CloseOnExit option. To do this, follow these steps:
- Add the word MAYSCRIPT to your applet tag, along with a NAME= attribute assigning a unique name to this instance of the applet, so that it looks something like this:
<APPLET CODE="ryElevator.class" WIDTH=200 HEIGHT=400 ARCHIVE="Elevator.jar" NAME="dynamix" MAYSCRIPT>
- Add the following script to the page, making sure the name (in bold text) matches the name you assigned to the applet in step one:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function toggleMenu()
{
document.dynamix.setCloseOnExit(document.frm.checkbox1.checked);
}
</SCRIPT>
- Add the following HTML form code to your page where the checkbox should appear. The text in bold type can be anything you like.
<FORM NAME="frm">
<LABEL FOR="checkbox1"><INPUT TYPE=CHECKBOX NAME="checkbox1" ID="checkbox1" ONCLICK="toggleMenu()" CHECKED>Auto-collapse menu</LABEL>
</FORM>
- Finally, if you've set your CloseOnExit parameter to 'No', remove the word CHECKED from the INPUT tag above so that the initial state of the checkbox matches the initial behavior of the menu.
You can see this in use in Example #3.
|