targetfeatuers attributes

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

targetfeatuers attributes

Post by dmj120 »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Code: Select all

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
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

John
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

Ok, thanks, got most of the menu items open a new page with:

Code: Select all

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. :?:
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

dmj120 wrote:

Code: Select all

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: Select all

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?
Last edited by John on Mon May 24, 2004 8:23 pm, edited 1 time in total.
John
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

i did have the " ; " at the end of the items. I got more items to open correctly omitting the " ; "

http://swlct.com
Josh
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

Kevin,

Are the windowNames specific to anything or can I just 'give' each item a different name?
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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Josh,

Use any name you like, but avoid spaces. I.e.,

Code: Select all

target=my new window
would be bad.

Code: Select all

target=myNewWindow
or

Code: Select all

target=my_new_window
should be fine.

Kevin
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

:D :D 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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Josh, while Kevin nailed what is apparently the fix (given the :D :D ), I will just say thank you very much for the kind words. They are sincerely appreciated :!:
John
dmj120
Advanced
Advanced
Posts: 17
Joined: Sat Jan 17, 2004 11:48 pm

Post by dmj120 »

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
Post Reply