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: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:28

AJAX in menu


Poster: WLQ's
Dated: Thursday October 11 2007 - 15:09:21 BST

How can I change the normal url= in the menu into this so the menu will work?

<a onclick="DlePage('do=cat&category=main'); return false;" href="http://something.com/category/main/">Main page</a>

Re: AJAX in menu


Poster: Ruth
Dated: Friday October 12 2007 - 4:23:08 BST

Hi,

There is actually an ajax menu available I believe

http://www.milonic.com/ajaxmenus/

I will post to Milonic and ask about how to do what you want, but I kind of need to know what it is you're doing. I can many times figure out the solution, but I need an actual working page with the link in it to see what's going on and then I can test different things in a menu data file. I'm assuming that the part after the onclick is some kind of function. You can call functions in the url= ; for example:

at the top of the menu_data file before the first style you'd put the function

Code:
var newwindow;
function mywindow(url)
{
   newwindow=window.open(url,'name','height=500,width=400,left=100,
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');

}


Then the aI would have

Code:
I("text=item;url=javascript:mywindow('http://whatever/');");


Don't know if this is helpful or not, I'm out of my knowledge area :)

Ruth

Re: AJAX in menu


Poster: WLQ's
Dated: Friday October 12 2007 - 10:56:24 BST

I just need to put this function

<a onclick="DlePage('do=cat&category=main'); return false;" href="http://something.com/category/main/">Main page</a>

inside the url tag. But the problem is that menu doesn't understand ():, any of this inside the tag.

Re: AJAX in menu


Poster: Ruth
Dated: Friday October 12 2007 - 14:48:11 BST

Hi,

Well, it does understand it as far as I know, but I can't test yours because I don't know what the actual function is.

Take a look at this demos page which has a function called in the url parameter using url=javascript: then the function named followed by the (parameters) and it works fine.

http://support.milonic.com/demos/load_m ... /index.htm

This function is called in the aI string, in the url= parameter and it loads two pages at one time in two different iframes on a page. There is a full explanation on that page.

Re: AJAX in menu


Poster: WLQ's
Dated: Friday October 12 2007 - 20:39:37 BST

well the tutorial example did work but yours not, the function I gave you is the whole function, the actial ajax properties... is on my engine files, all I need is just to put the line which I gave you, if I put it instead of normal link the ajax function will work, so all i need is to put this line I gave you, i don't know well milonic maybe you can do as a function url=javascript and something like ajax function... or maake a fuction at the top of the page and recall it by url=javascript:2 or something, if you realy cannot find out how I will give you admin to my site to check how it will work

Re: AJAX in menu


Poster: Ruth
Dated: Saturday October 13 2007 - 4:30:58 BST

Hi,

I'm sorry, I think I totally misunderstood you as you can see by my responses. I have posted to Milonic, but you might contact them directly.

I did actually get a link to work, but since I had to just put in a url that I could get to I have no idea if what you want would work. I mean I don't have any kind of site with a /category/main folders on it. And, I don't know if what I set up would work or not for you but try this, it should be all one line no wrapping. Of course you'll need to put in the correct http link unless your site is something dot com :) As I said, when I put my site in http://www.poems2u.com/writings/cyberpunk.html it worked fine, but that is a full url...

Code:
aI("text=<a onclick=\"DlePage('do=cat&category=main')&#59 return false&#59\" href='http://something.com/category/main/'>Main page</a>;type=html;");


Ruth

Re: AJAX in menu


Poster: WLQ's
Dated: Saturday October 13 2007 - 15:34:27 BST

Oh it did work!!! Thank you very much you really are the PRO.

Thanks, take care!

Re: AJAX in menu


Poster: Ruth
Dated: Saturday October 13 2007 - 18:42:39 BST

Hi,

I'm glad it works. Hopefully, I will get a response from Milonic on how to do this, because that is a difficult way, I think. I'll post back to here if they respond with an easier way.

I believe that if you actually use the ajax menu you would just put it in as you had it and it would then run through the ajax processor. I know that if someone is doing cold fusion or php and has those functions or commands in the items, they change the extension of the menu_data.js to .cfm or .php, this makes the data file go through those processors. [I think :? ]

Ruth

Re: AJAX in menu


Poster: Andy
Dated: Monday October 15 2007 - 17:55:16 BST

Hi,

There are several ways you can execute a Javascript function from within the menu.

Here's the easiest way:

Code:
aI("text=Main Page;url=http://something.com/category/main/;clickfunction=DlePage('do=cat&category=main');custom=retFalse");


Note that there is a property called custom, this is used for returning either true or false so that the url is either executed or ignored.

If you want the menu item to execute the JavaScript function and follow the link to http://something.com/category/main/ you'll need to remove the custom property so that it looks like this:

Code:
aI("text=Main Page;url=http://something.com/category/main/;clickfunction=DlePage('do=cat&category=main');");


If you want to execute the function but not follow the link to http://something.com/category/main/ put custom=retFalse"; into the aI string.

HTH,
Andy