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

How to transfer parameter url in function of the menu?


Poster: AlexDulub
Dated: Sunday February 22 2004 - 14:28:31 GMT

The user chooses something on a page and according to it should be formed url. Here at me a question. How to transfer parameter url in function of the menu?

Something like this :

.html:
popup('milonic','menu','my parameter')

.js:
aI("text=Enter;url=and here I want my parameter");

or better so:
aI("text=Enter;url=index.php?" + and here I want my parameter");

As to me it to make? It is possible?[/i]


Poster: kevin3442
Dated: Monday February 23 2004 - 17:21:24 GMT

Hi Alex,

If I understand:

html: You cannot pass a url to trhe popup() function. popup() is only for opening a menu and has nothing to do with URLs.

js: Pass a URL exactly as you would in any other link, like so:
Code:
aI("text=Enter;url=index.php?location=1;");

Since all of the argument to the aI() funciton is a string, you could also pass parameters through string manipulations, like this:
Code:
loc = 1;
paramStr = "location" + loc + ";";
.
.
.
aI("text=Enter;url=index.php"+paramStr+"status=go to new location;[i]...other properties as needed...[/i];");

Hope that helps,

Kevin


Poster: AlexDulub
Dated: Monday February 23 2004 - 20:39:18 GMT

Many thanks for this answer. There is at me another question. How in menu.htm keep some parameter, what I then could take away it from menudata.js? Something like this:

.html:
function SaveParameter(page) {
var some_parameter = page;
popup('milonic','Milonic')
}

.js:
aI("text=Enter;url=index.php"+some_parameter");


Poster: kevin3442
Dated: Monday February 23 2004 - 21:49:06 GMT

Sorry... but I do not understand the question.

Kevin


Poster: AlexDulub
Dated: Monday February 23 2004 - 22:52:39 GMT

I'm from Russia and my english not well(sorry for this). I try to explain. I want to keep some parameter. Couse I don't know what user will choose. For example: User choose on the page(menu.html) something and after that I must redirect user to 'menu.html?parameter=something'(using your menu...). Here I have a problem how to transfer this parameter something in menu_data.js.

I want to make so :
aI("text=Enter;url=menu.php?parameter="+something);

Alex Dulub.
[/i]


Poster: Maz
Dated: Monday February 23 2004 - 23:27:18 GMT

Sounds a bit like where I left off, its probably a server side configuration or what ever you call them.

Lets see if its the same thing, so I would click on a menu link to type=1, where I get a selection of links, I click one and the url goes to id=1 of type 1. But it no longer is an active page on the menu.

In my case it would be nice to still register as an active page within type 1, I'm not sure how he's trying to use it. But I had thought of making a menu item appear for that area.

If type=1 showmenu id=all

Am I close?

maz


Poster: AlexDulub
Dated: Tuesday February 24 2004 - 0:35:09 GMT

I know how to explain. On page menu.htm at me a chessboard. The user clicks for example on e4 and at him jumps out the menu, that it wants to make (to resemble, make a check, to bring down a figure...) Here I also should be sent coordinates of his course on other page what to process it there (whether whether to check up it is possible so to resemble, check up is mat, etc.) At once I do not know where the player will press (therefore it is necessary to send parameter).


Poster: kevin3442
Dated: Tuesday February 24 2004 - 0:55:06 GMT

Hi Alex,

Your English is much better than my Russian!

I am still not sure that I understand completely, but I will try to answer what I think you are asking.

(1) In your menu_data.js file, at the top, you could define the variable, something, which will be used to store the result of a user clicking on one of the links in the .html page. You would also define a function, called setSomething(), to set the value of the variable something. Like this:
Code:
var something;

function setSomething(value)
{
  something = value;
}

(2) In your .html document you could have links like this:
Code:
<a href="javascript:setSomething('e4')">link text or image</a>
<a href="javascript:setSomething('e5')">link text or image</a>

Each of the links, when clicked, calls the setSomething() function and passes a value to set the something variable to.

(3) Your menu item could then pass the current value of something in its URL, like this:
Code:
aI("text=Enter;url=menu.php?parameter="+something+";");


I hope that helps,

Kevin

P.S. Maz -- I still don't understand your goal. :? Sorry.


Poster: AlexDulub
Dated: Wednesday February 25 2004 - 11:28:39 GMT

Hello ,

Many many thanks for your reply. But programm don't still work. I have an error with on undefined value. I made programm according with your instructions.

in .html file I have function:

function Save_parameter(parameter);
{
link = parameter;
popup('milonic','Milonic');
}

...
onmousedown=Save_parameter('<? echo $i$j ?>')
...

.js file:

aI("text=Take current position; "url=index.php?parameter="+link+";");

And IE show me that link is undefind.

Please accept my thanks in advance.

Alex Dulub


Poster: kevin3442
Dated: Wednesday February 25 2004 - 16:23:41 GMT

Hello Alex,

This is only a guess since I cannot see your entire page, but I think that your link variable may not be global.

Is link declared anywhere outside of the Save_parameter() function? In my previous example, you will notice that the variable, something, is declared outside of the setSomething() function, like this:
Code:
var something;

function setSomething(value)
{
  something = value;
}

Declaring the variable outside of the function make's it global in scope, so that its value can be accessed in multiple functions on the page. In your case, if link exists only inside of the Save_parameter() function, then its value is accessible only inside of that function, and it therefore has no value... it does not exist... outside of that function. To make a variable global, declare it outside of a function definition, like this:
Code:
var link;  // this declaration makes it global

function Save_parameter(parameter);
{
link = parameter;
popup('milonic','Milonic');
}


I hope that helps,

Kevin


Poster: AlexDulub
Dated: Thursday February 26 2004 - 12:16:26 GMT

Hello Kevin,

Thanks for reply. But I still have a problem.

When I do so, the menu is not shown.

html:
<SCRIPT language=JavaScript>
var url;
function leavePage(page) {
url = page;
popup('milonic','Milonic')
}
</SCRIPT>

js:
with(milonic=new menuname("Milonic")){
style=menuStyle;
aI("text=Enter;url=index.php"+url+";");
}

or so
js:
with(milonic=new menuname("Milonic")){
style=menuStyle;
aI("text=Enter;url=index.php"+url);
}



When I clean "+url" that all is perfectly shown. Like this:

js:
with(milonic=new menuname("Milonic")){
style=menuStyle;
aI("text=Enter;url=index.php");
}


Please accept my thanks in advance.

Alex Dulub