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

Convert Form Button Link to aI Menu Link


Poster: Ralls
Dated: Wednesday January 24 2007 - 8:49:41 GMT

I have a form button link that I would like to convert to a regular aI menu link but I'm having problems. Here is the form button code:

<input
type="button"
value="ENTER"
onClick="var mywindow = window.open('http://www.domain.com/index.html','portal','height=5000px,width=5000px,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=0px,left=0px'); mywindow.moveTo(0,0);mywindow.resizeTo(screen.width,screen.height); mywindow.focus();">
</form>

This opens a new window (which is what I want), but I don't know if I need to specify the target as "_new"? Any help or suggestions would be greatly appreciated. Thanks.

To be more specific...


Poster: Ralls
Dated: Wednesday January 24 2007 - 9:52:10 GMT

My primary interest is how to code the form button link so it works as an aI menu link (not what the target name is). I've tried several approaches without success. I'm sure I'm missing something simple. Any help putting this form button link in the right aI format would be greatly appreciated. Thanks.


Poster: Andy
Dated: Wednesday January 24 2007 - 10:38:52 GMT

Are there any other properties in your form?

You say that you want to use a menu item as a submit button but this may cause problems due to the fact that the menu must become part of the form.

If the form itself was inside a menu item this wouldn't be a problem because the object itself is contained inside the menu. The way I see you doing it at the moment is have a FORM, then a menu inside the FORM. Not sure if this will work.

You got anymore HTML that you can show us?

Form Button Link...


Poster: Ralls
Dated: Wednesday January 24 2007 - 10:48:49 GMT

I don't want an actual button on my menu, I just want an aI link that accomplishes the action of the form button. I'm sorry I wasn't clear.


Poster: Andy
Dated: Wednesday January 24 2007 - 10:51:27 GMT

That's what I said, in other words you want to emulate what happens when you click on a submit button but in a menu item instead?

We are going to need to see your form structure, you got anything we can see?

This is my attempt at an aI link


Poster: Ralls
Dated: Wednesday January 24 2007 - 11:04:10 GMT

Andy, first thanks for the prompt help.

The form code I provide works as html in my page (domain changed) and provides the new window I desire. In my menu, here is my attempt an an aI link that accomplishes the same function:

aI("text=Test;url=http://www.domain.com/index.html; target=_new;targetfeatures=width=5000px,height=5000px,status=no,menubar=no,scrollbars=yes,resizable=no,top=0px,left=0px);w.resizeTo(screen.width,screen.height); w.focus()" );

While this seems to work in my menu, I know that the last part of this syntax is incorrect, i.e., the part "w.resizeTo(screen.width,screen.height); w.focus()" );"

But, I would like the window re-sized to the width and height specified and the window to have focus.

I guess more specifically, how would you clean up the aI link above to make it "correct"?

I'm sorry is this is confusing.


Poster: Andy
Dated: Wednesday January 24 2007 - 11:18:40 GMT

I take it that w is a variable you have set previously for window?

If so, your aI string should be like this:

Code:
aI("text=Test;url=http://www.domain.com/index.html;target=_new;targetfeatures=width=5000,height=5000,status=no,menubar=no,scrollbars=yes,resizable=no,top=0px,left=0px);clickfunction=`w.resizeTo(screen.width,screen.height);w.focus()`");


HTH,
Andy


Poster: Andy
Dated: Wednesday January 24 2007 - 11:39:26 GMT

Quote:
Andy,

No, I haven't set the variable as I don't know how to do that.

How would I set a variable to "w" so that it applies to this aI code (and where would I do it)?

Or, if there is an easier way to accomplish the same thing without a variable, please let me know. Maybe that would be simpler.

Thanks again!


In that case, try this instead:

Code:
aI("text=Test;url=http://www.domain.com/index.html;target=_new;targetfeatures=width=5000,height=5000,status=no,menubar=no,scrollbars=yes,resizable=no,top=0px,left=0px);clickfunction=`_W.resizeTo(screen.width,screen.height);_W.focus()`");

One more question


Poster: Ralls
Dated: Wednesday January 24 2007 - 12:12:45 GMT

Thanks, that really helps.

One last question. I take it the "_W" acts like a variable and could be any value, including "_mywindow" as I used in the form button code. Is that right?

I really appreciate your help.


Poster: Andy
Dated: Wednesday January 24 2007 - 12:30:36 GMT

_W is an alias for the window object.

In theory though it could be anything you like that supports the resizeTo and focus methods like another window or frame

Variable


Poster: Ralls
Dated: Wednesday January 24 2007 - 13:11:32 GMT

One last point.

Just to make sure I understand, is it correct that I could use "_mywindow" or "_global" or "_newwindow" or "_[something else]" in place of "_W"?

The reason for this question is that I really don't know what terms would support the resizeTo and focus methods and which terms would not. It sounds like most would.

The answer to that should question finally take care of this and thank you again. Your support has been refreshingly prompt, direct, and helpful.