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:51

Launch menu via onlclick


Poster: Darkangel
Dated: Friday March 4 2005 - 23:50:19 GMT

Hi to all of you,

I've downloaded a free version of the Classic XP Style Menu in order to test it before purchaising it!

However i've got this problem!
I'm gonna use two menus on my webpage

and one should be opened via a button

i mean that the customer should click on a button then the menu appears!
as soon as the customer leave the menu via onmouseout, the menu should disappear!
How can i do that please??

thanks in advance


Poster: Ruth
Dated: Saturday March 5 2005 - 2:41:46 GMT

Code:
openonclick Allows the menu to be opened by a click of the mouse on the main menu
rather than it automatically opening as the mouse rolls over it.  Values: 'true', 'false',
'0' or '1'  Example: openonclick=true;
Example: openonclick=0;


Place that code in the menuStyle.

There are some reference guides for different menu properties, style properties and item properties that can be applied. The links are below my name.

Ruth


Poster: Darkangel
Dated: Saturday March 5 2005 - 8:37:08 GMT

Humh..

Sorry for this wrong explanation of what i want so!!

I do not want the submenus to be opened by a click but i want the main menu!!

I on other word the main menu itself should only be opened by a click!!
and disappear after using it!

Thanks in advance


Poster: Ruth
Dated: Saturday March 5 2005 - 11:37:29 GMT

Hi,

You would just create a menu that you want to be the 'button' it can be text or an image. You create it just like any menu. Then you code it like it's the main menu, which in effect it will be, setting it to always visible, setting the top, left etc. In it you would code the item that you want to open the main menu openonclick=true; The normal action of the menu when using openonclick is to have the click open the called menu and from that point on all menus will open and close when you move the mouse over and off. You then get rid of the main menu positioning and always visible so it acts like a submenu. i.e.
Code:
with(milonic=new menuname("Button")){
style=menuStyle;
top=10;
left=20;
alwaysvisible=1;aI("text=Click for Menu;openonclick=true;showmenu=main menu;"); }
That would open the menu named main menu
Code:
with(milonic=new menuname("Main Menu")){
style=menuStyle;
orientation="horizontal";
aI("text=Home;url=http://www.milonic.com/;status=Back To Home Page;");
aI("text=Menu Samples;align=center;showmenu=Samples;title=All Samples");
aI("text=Milonic;showmenu=Milonic;"); aI("text=Back;url=javascript:history.go(-1);");
aI("text=Next;url=javascript:history.go(+1); ");
}


In effect what you are doing is just making the main menu act as a submenu, and creating a 'button' to open it with a click. You could use an image for that button menu, and you could set the menu to followscroll=1; if you want the menu to follow the scroll down the page. It finishes it's scroll always at the top of the browser window.

Milonic Menus are very versatile. You could even use this to have a number of buttons that are always visible and will open the main menu. You would just have to make a different menu, say button, button1, button2 have each one showmenu=main menu, and set each one to the position you want it to have on the page.

Ruth


Poster: Darkangel
Dated: Saturday March 5 2005 - 12:20:04 GMT

Thanks Ruth, it perfectly answer to my problem!

Nevertheless, I still have another question which relates to something else!

In my website i've got a multilanguage script made in php which workds perfeclty!

Consequenlty i want your menu to also appear in all languages and my question is the following:

i need to replace Home by an <?php echo "txt-men1" ;?> in the line below

aI("status=Back To Home Page;text=Home;url=http://www.milonic.dev/;");

How can i add php script in a js file?
If not possible as i think, am i supposed to create different version of the file menu_data.js??

Thanks in advance


Poster: Ruth
Dated: Saturday March 5 2005 - 14:38:04 GMT

I have not a clue, that is way over this volunteer's head. A few thoughts come to mind

1. as you mentioned, making a different data file for each language. I've seen that on a number of sites, when the person clicks Spanish, the corresponding pages load with their spanish_data.js file

2. Someone in a post suggested writing text for the menus and using an if/else statement. Again, this is outside my field of knowledge

3. There is a php/mysql Milonic Menu. You can see that here There is a download zip file for that. It also has an asp/mysql. I have no idea what any of that is, so I don't know if any of it would be useful.

I know that this site's menu data file is a php menu_data.php and there are some posts on using php/mysql
http://www.milonic.com/forum/viewtopic.php?p=13223

http://www.milonic.com/forum/viewtopic.php?p=23523

http://www.milonic.com/forum/viewtopic.php?p=21693

http://www.milonic.com/forum/viewtopic.php?p=19081

http://www.milonic.com/forum/viewtopic.php?p=18361

And, I remember in one post something about making different files and then using an if/else to call them.

I don't know if any of that will help you.

Ruth


Poster: Darkangel
Dated: Saturday March 5 2005 - 19:05:22 GMT

Thanks for all your help, scrit now works perfectly!

Nevertheless, i still have one last interrogation!

i need to change the height of the image: test.gif
aI("image=img menu/test.gif;openonclick=true;showmenu=main menu;"); }

Indeed, i need to fix it to 33..
how can i do that within your script!

thanks in advance


Poster: Ruth
Dated: Saturday March 5 2005 - 23:55:56 GMT

I'm not sure what you mean. Since that menu is a one item menu and you are using image= then the menu will be whatever size the image is. If you are thinking about an html page and how you can put in a different size for the image than it is and that's the size the browser makes it, no that doesn't happen in the menu.

You can do a number of things:

1. make the image the size you want the menu item to be.

2. use a blank image [an image without text] as a background and put text in the item, aI("text=Click here;bgimage=myimage.gif;itemheight=33px;

Below my name are some links to style, menu, item property references which describe the various properties. There is also a beginner's guide in the forum section, very basic as to using colors and such, and a Beginner's User Manual online which has much more information.

Ruth


Poster: Darkangel
Dated: Sunday March 6 2005 - 0:18:17 GMT

Since i've changed my previous script line by this one:

aI("text=Click here;bgimage= img menu/img.gif;itemheight=33px;itemwidth=101px;openonclick=true;showmenu=Main menu;"); }

it works perfectly however the Click here is changed by MILONIC!!!

why this automatic change, and how to remove it??

Thanks


Poster: Ruth
Dated: Sunday March 6 2005 - 0:55:22 GMT

If you have purchased the menu, then you need to be logged in when you download it, and it will put in the correct url for the menu and that link will not appear. If you are qualified for a free license, then you need to have the required link back to Milonic on every page on which the menu appears. Read this post by Milonic Menus And, here's information on the Free License.

Ruth


Poster: Darkangel
Dated: Sunday March 6 2005 - 9:09:52 GMT

O thanks, i'll leave the div line until i've finished the construction of my entire website and then come back to pruchase what is needed...


Last question however:
in a line like that:
aI("text=menu .....

how can i center the word menu, i mean how to put it in the middle of the background image??
thanks in advance


Poster: Ruth
Dated: Sunday March 6 2005 - 9:37:41 GMT

align is a property that can be used in either the style section, which means that all text will align at whatever you set, or it can be put into the menu itself, which means all text in that menu will align where you set it, or it can be put into the item and only that item will take on the align property.

Ruth


Poster: Darkangel
Dated: Sunday March 6 2005 - 18:12:49 GMT

i'm sorry but i'm not an expert in javascript and consequently i can't arrive do make my code works!!

i simply try to have my text centered by adding following code:
text-align= center;
or even align :center

but none works

could you please help me for this last problem i've got?
Thanks in advance


Poster: Ruth
Dated: Sunday March 6 2005 - 18:52:55 GMT

Code:
with(menuStyle=new mm_style()){
onbgcolor="#4F8EB6";
oncolor="#ffffff";
offbgcolor="#DCE9F0";align="center";
In this section align="center"; will align all text to the center in any menu that uses this style.

Code:
with(milonic=new menuname("Main Menu")){
style=menuStyle;
top=10;
left=10;
alwaysvisible=1;
orientation="horizontal";
align="center";


In this section align="center"; will align all text in this menu in the center.

Code:
aI("text=Home;align="center";url=http://www.milonic.com/;status=Back To Home Page;");
Put in the item, it aligns the text of the item in the center.

Ruth


Poster: Darkangel
Dated: Sunday March 6 2005 - 21:25:46 GMT

I've tried this already but nothing appears anymore!

aI("text=Lancer;align='center'; bgimage= img menu/img.gif;itemheight=33px;itemwidth=101px;openonclick=true;showmenu=Main menu;"); }


Poster: Darkangel
Dated: Sunday March 6 2005 - 21:33:54 GMT

I've tried this already but nothing appears anymore!

aI("text=Lancer;align='center'; bgimage= img menu/img.gif;itemheight=33px;itemwidth=101px;openonclick=true;showmenu=Main menu;"); }


Poster: Ruth
Dated: Monday March 7 2005 - 0:46:31 GMT

Code:
aI("text=Lancer;align=center;bgimage=img.gif;itemheight=33px;itemwidth=101px;openonclick=true;showmenu=Main Menu;");


That works. Note there are no quotes around center. Of course, you have to put the correct path to the image. I don't know what folder has your image. It looks like img menu, and I'm sure you don't have a folder with a space in the name. So, if it's img, then it would be bgimage=img/image.gif. If it's menu it would be bgimage=menu/image.gif. Can you post a page with the menu up so we can see what's going on?

Ruth[/code]


Poster: Darkangel
Dated: Monday March 7 2005 - 9:01:35 GMT

I've corrected the problem, thanks for your help!

nevertheless, i'm confronted to another problem in relation to the position of the menu now

on my computer the fullcreen is working perfectly so the menu appears exactly where i want it, however as you might now due to sp2 other computer might not see the page in fullscreen consequently the menu is not placed where it should!!

let me explain the problem in much more details:
For instance for the button i've got that:

with(milonic=new menuname("Start")){
style=menuStyle;
LEcran = screen.height
top= LEcran- (32);
left=0;
alwaysvisible=1;
aI("text=Lancer;align=center;bgimage=imgmenu/baseline_begin.gif;itemheight=33px;itemwidth=101px;openonclick=true;showmenu=Main Menu;");
}

Nevertheless, as ohter comptuer might not use the total fullscreen mode the screen.height is not valid anymore!
so that i have to use the window.height i think!!
But my question is the following, in order to know if the customer is using fullcreen mode (the total mode) i need to compare the screen.height and window.height? Is that right? but how to do that?
and follqing the answer give the right coordination to the button?
i'll do the same for the menu in itself ,after...

Thanks in advance


Poster: Ruth
Dated: Monday March 7 2005 - 9:48:58 GMT

I have no idea. I don't even know
Code:
what LEcran = screen.height
top= LEcran- (32);
is doing. You need to put this as a new topic, with a new title that refers to the issue, where someone else will see it based on the topic title.

As requested, we need to see a url and the page. There's no way we can 'visualize' without know what you want. For example, if you want the menu in the same place, no matter the window size, perhaps placing that menu button in a table would be the solution, if you are using tables. It would always be in the same cell no matter the resolution the person is using and how the table shifts as the resolution changes.

Ruth