Make your own free website on Tripod.com

Javascript Tips

To enable Javascript support:

* add MAYSCRIPT to the applet tag;
* add javascript:N parameter with javascript call value, where N - any number;
* place javascript:N string in the link;
* set the target to "_"
as shown in the following example :
<applet code="apMenu" archive="apMenu.jar" Width="125" Height="156" MAYSCRIPT>
      <param name="javascript:1" value="somefunction('param1','param2')">
      <param name="javascript:2" value="open('index.html','_blank')">
      <param name="menuItems" value="
              {Script1,javascript:1,_}
              {Script2,javascript:2,_}"> 
</applet>

Javascript calls limitations:

* Value and variable assignments are not supported
* Empty strings in arguments are not supported
* Use single quotes (') instead of double quotes (") for arguments
* Arguments are treated as String literals during the function call. Therefore, they must be converted to the appropriate format using standard Javascript methods such as parseInt(String) and parseFloat(String).

The best way to overcome most of the limitations is placing the instructions within a javascript function:

.....
function open_w(arg){
 if (confirm('Open a new window?') == true){
      open(arg,'window','scrollbars,resizeable=yes,width=680,height=600')
    }
}
.....
      <param name="javascript:1" value="open_w('index.html')">
      <param name="menuItems" value="
              {Open window,javascript:1,_}"> 
.....