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: Wednesday July 18 2012 - 06:07:43

Dynamically creating menus...


Poster: paulm __at__ mit-comms.co.uk
Dated: Tuesday March 26 2002 - 12:19:37 GMT

I am trying to create a pop-up menu that will allow me to view/edit a users details.

This is all being called from a server-side script to dynamically build the client-side script to show the pop-up on a graphic next to the user's name.

When ever I try to do this, it fails with "Object required"......what am I doing wrong.

Regards,

Paul.



ASP SCRIPT:
' Add the menu for this extn....
a = "addmenu(menu=['xtn',,,250,1,'',style1,,'left',effect,,,,,,,,,,,,,' View Details ','dir2.asp?extn=KEY',,,0,' Show all Users ','dir2.asm?sextn=NUM',,,0,' Edit this User ','extensionedit.asp?extensionkey=KEY',,,0])"

a = replace(a,"KEY",rs("extensionkey"))
a = replace(a,"NUM",rs("extn"))
a = replace(a,"'",chr(34))

response.write "<SCR"

Re: Dynamically creating menus...


Poster: manight __at__ tin.it
Dated: Monday February 25 2002 - 17:58:10 GMT

Hi,

The actual code that is generated works fine so I'm thinking that it might be something else.

Does the code work without the ASP additions?

The way I would do this is change the file extension on menu_array.js from .js to .asp. This will force IIS to parse this file.

Then try something like this.

addmenu(menu=["extn<% =rs("extensionkey")) %>",,,250,1,"",style1,,"left",effect,,,,,,,,,,,,
," View Details ","dir2.asp?extn=<% =rs("extensionkey")) %>",,,0
," Show all Users ","dir2.asm?sextn=rs("extn"))",,,0
," Edit this User ","extensionedit.asp?extensionkey=<% =rs("extensionkey")) %>",,,",,,0
])

Might need a bit tweaking but it's an idea.

Cheers
Andy

Re: Dynamically creating menus...


Poster: smac
Dated: Monday February 25 2002 - 19:12:24 GMT

No, it works fine if I force the menu to be displayed (i.e. just naming the submenu 'fred'), it just doesn't seem to create the new menus...

I have used response.write to view the 'parsed' code to the client screen, and looking at the page source on the destination, the <SCRIPT> </SCRIPT> elements are there along with the addmenu code.

Generated HTML:
<SCRIPT Language=Javascript>addmenu(menu=["extn27",,,250,1,"",style1,,"left",effect,,,,,,,,,,,,," View Details ","dir2.asp?extn=27",,,0," Show all Users ","dir2.asm?sextn=4014",,,0," Edit this User ","extensionedit.asp?extensionkey=27",,,0])</SCRIPT>


I notice that there is no error generated (i.e. Javascript errors) at the client end.

Regards,

Paul.