Menus generated dynamically??

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
skyfire
Beginner
Beginner
Posts: 3
Joined: Sun Sep 08, 2002 5:57 am
Contact:

Menus generated dynamically??

Post by skyfire »

Is it possible to access the addmenu() function from outside of the array JavaScript file?

What I would like it is to have the menus generated dynamically from controlling perl code, which would call the addmenu() from outside of the array JavaScript file.

The way I wanted to have it was using frames so there would be multiple array JavaScript files to access.

Is this possible? If so how do I refer to the array js file.addMenu()?

Skyfire
sacha
Beginner
Beginner
Posts: 4
Joined: Mon Sep 09, 2002 2:54 pm

Post by sacha »

Hi,

Perl is executed on the server - JavaScript is executed by the client browser. So Perl has no chance to access any JavaScript functions.

Of course you can handle the JavaScript file as a text file and manipulate it with Perl on the server.

This way you can write the addmenu function calls with their parameters into the javascript files.

The client loads it and gets your dynamically created menu.

If you`d like to write something into the menu_array.js file depending on the browser the client uses, I`d recommend php.

You could sniff the browser with a current browscap.ini (e. g. http://www.garykeith.com/browscap.asp) and write the JavaScript-Code you want to be executed on the client side into the JavaScript file.

You`d only need a webserver that supports php, rename the .js file to .php and include this .php file instead of the .js file into your html-document.

hope that helps and that I didn`t get you wrong,

Sacha
Post Reply