Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:44

Menus generated dynamically??


Poster: skyfire
Dated: Sunday September 8 2002 - 6:07:07 BST

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


Poster: sacha
Dated: Monday September 9 2002 - 20:46:28 BST

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