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:27
targetfeatuers attributes
Poster: dmj120
Dated: Monday May 24 2004 - 0:09:45 BST
I have tried the targetfeatures -- but I can't figure out how to include to toolbars. Basically I would like a sizable "target=_blank"...
something that could include opening a new page with width / height attributes and possibly position.
Any suggestions??
Thanks in advance
Josh
Poster: Ruth
Dated: Monday May 24 2004 - 1:32:21 BST
Code:
url=http://www.whateversite.com/whateverpage.html;target=_new;targetfeatures=width=440 height=410 toolbar=no location=no directories=no status=no menubar=no scrollbars=no resizable=no copyhistory=no;");
Of course the code doesn't wrap in the file. Take your pick of the features you want and leave out what you don't. That one will give you a window 440x41 with only a colored bar at the top with the little boxes to close, and I think minimize, but nothing else, no address bar, no file/edit/view part, no status bar at the bottom, no scroll bars, none of the refressh, back, forward icons, won't be resizable, and not sure what teh copyhistory is, perhaps it doesn't go into the history file either....
Ruth
Poster: dmj120
Dated: Monday May 24 2004 - 1:56:40 BST
the url bar/file/edit/view... refressh, back, forward icons... are the things that I am talking about. I tried target new and all of the targetfeatures, does this mean that I can't have a new window pop up with all of the url bar/file/edit/view... refressh, back, forward icons..., that can be set at an initial size eg. 600x600
Poster: John
Dated: Monday May 24 2004 - 3:24:36 BST
Check http://www.milonic.com/menusample11.php, and also http://milonic.com/forum/viewtopic.php?t=2981.
Poster: dmj120
Dated: Monday May 24 2004 - 4:30:33 BST
Ok, thanks, got most of the menu items open a new page with:
Code:
aI("text=Test Equip.;url=http://www.url.com;target=_new;targetfeatures=width=820 height=650 toolbar=yes location=yes directories=yes status=yes menubar=yes scrollbars=yes resizable=yes copyhistory=yes");
Once I found the code that worked I then copied it to all the other menu items, I don't understand why this works for some and not others. I have gone through the code and each line, they all look the same.
Poster: Ruth
Dated: Monday May 24 2004 - 5:51:35 BST
I think, if you want all the features all you have to do is put the width and height and if you don't put anything else, all the rest will show by default in the browser and the window would just be whatever height and width you give it.
Ruth
Poster: John
Dated: Monday May 24 2004 - 17:09:49 BST
dmj120 wrote:
Code:
aI("text=Test Equip.;url=http://www.url.com;target=_new;targetfeatures=width=820 height=650 toolbar=yes location=yes directories=yes status=yes menubar=yes scrollbars=yes resizable=yes copyhistory=yes");
You're missing a ; at the end of that line, but probably not the ultimate fix...
Code:
aI("text=Test Equip.;url=http://www.url.com;target=_new;targetfeatures=width=820 height=650 toolbar=yes location=yes directories=yes status=yes menubar=yes scrollbars=yes resizable=yes copyhistory=yes;");
Note the =yes;"); .
How 'bout a URL so we can see what's up?
Poster: dmj120
Dated: Monday May 24 2004 - 17:47:52 BST
i did have the " ; " at the end of the items. I got more items to open correctly omitting the " ; "
http://swlct.com
Josh
Poster: kevin3442
Dated: Monday May 24 2004 - 19:37:59 BST
dmj120 wrote:
...I don't understand why this works for some and not others...
Can you post a url to your test page, or post the code for some of the items that don't work?
Ruth wrote:
I think, if you want all the features all you have to do is put the width and height and if you don't put anything else, all the rest will show by default
Actually, I believe the default state for most of those features (toolbar, menubar, location, etc.) is "no".
dmj120 wrote:
something that could include opening a new page with width / height attributes and possibly position
Position is another matter. You can control position by setting additional "features" in the window.open() method (which is what the targetfeatures in the aI() string are passed to), but these tend to be browser specific. For example, you could set top=100 and left=100, but that would only work in IE4+. You could set screenX and screenY, but those are specific to NS. So, the features Andy listed in the sample page John pointed to (sample11) are the features that are common across browsers, like width and height. Another approach would be to write a js function that would open a new window for you, with the size and other features you want, and then reposition the new window to the location you want using the moveTo() method.
Cheers,
Kevin
Poster: dmj120
Dated: Monday May 24 2004 - 19:51:30 BST
Kevin3442
the url were the code lies is http://swlct.com i think you are correct about the features (toolbar, menubar, location, etc.) is "no".
I am still puzzeled to why some items open a seperate 'sized' page and others don't. The position is not really an issue, was just wondering if it could be done. I mainly would like the links to open a sized window at 820x600, which about half do.
Putting the " ; " at the end of the aI's did not help, actually I can get more links to open in a sized window without the end " ; ".
Josh
Poster: kevin3442
Dated: Monday May 24 2004 - 20:17:23 BST
Hi Josh,
This may be superstitious on my part, but instead of target=_new (which has a particular meaning in a standard <a> link), I'd try target=windowName, where windowName is a name to give to the new window. This functionality of the menu is undoubtedly using the js window.open() method, which normally takes three parameters, the name of the new window, the url for the wiondow, and the features of the window (width, etc.). If you use a different windowName for each menu item, then each item is guaranteed to open its link in a new window. If you use the same windowName for all or some menu items, and if the window is already open, then when you click an item that is supposed to open in that window (based on windowName), it'll ust replace the content in the already-opened window.
Let us know what happens.
Kevin
Poster: dmj120
Dated: Monday May 24 2004 - 20:22:36 BST
Kevin,
Are the windowNames specific to anything or can I just 'give' each item a different name?
Quote:
I'd try target=windowName, where windowName is a name to give to the new window.
This would explain alot of the wierd stuff going on.
Josh
Poster: kevin3442
Dated: Monday May 24 2004 - 20:36:32 BST
Josh,
Use any name you like, but avoid spaces. I.e.,
Code:
target=my new window
would be bad.Code:
target=myNewWindow
orCode:
target=my_new_window
should be fine.
Kevin
Poster: dmj120
Dated: Monday May 24 2004 - 20:52:27 BST
Thank you for your help!!!!!
This menu and support is definately worth the price, many times over!!!
I have and would again recommend this menu to anyone interested.
Thanks again
Josh
Poster: John
Dated: Monday May 24 2004 - 21:08:26 BST
Josh, while Kevin nailed what is apparently the fix (given the ), I will just say thank you very much for the kind words. They are sincerely appreciated
Poster: dmj120
Dated: Wednesday May 26 2004 - 4:07:18 BST
Perhaps I spoke too soon, the new windows open once, then if you click the same or other menu items the page opens in the original window.
I works once, this is really becoming frustrating.
Any other suggestions??
Josh
the menu is at http://swlct.com