PDA

View Full Version : jsDOMenu: Target problem



Küchenfachmann
11-11-2005, 12:54 PM
servus everybody!

I've got a problem with my jsDOMenu-Script (http://www.dynamicdrive.com/dynamicindex1/jsdomenu/).
I want to link sites into my iFrame, but where do I inset the Target in the JS-Script???
(My english is horrible... I'm from Preußen *ggg*)

Hier is a part of the script: (ddconfig.inc.js):


function createjsDOMenu() {
mainMenu1 = new jsDOMenu(130);
with (mainMenu1) {
addMenuItem(new menuItem("Myself", "", "myself.php"));
addMenuItem(new menuItem("JavaScript Kit", "", "http://www.javascriptkit.com (http://www.javascriptkit.com/)"));
addMenuItem(new menuItem("Coding Forums", "", "http://www.codingforums.com (http://www.codingforums.com/)"));
}


Please help!

Küchenfachmann
11-12-2005, 09:43 AM
Does no one know??? It's important.. :'-(

jscheuer1
11-12-2005, 10:17 AM
I really don't know but, according to the documentation it looks like -

Instead of:


addMenuItem(new menuItem("Myself", "", "myself.php"));

use:


addMenuItem(new menuItem("Myself", "", "code:iframe_name.location.href='myself.php'"));

where iframe_name is the name of the target iframe ex:


<iframe name="iframe_name"></iframe>

. This is a 'normal' type of link and will add to the history stack just like:


<a href="myself.php" target="iframe_name">Myself</a>

would. If you want to avoid adding to the history stack, use:


addMenuItem(new menuItem("Myself", "", "code:iframe_name.location.replace('myself.php')"));

Küchenfachmann
11-12-2005, 05:20 PM
Wow it works! Thank you very much! I've tested the code:iframe_name.location.href='myself.php'! =)

razu21
11-06-2007, 02:28 PM
Suppose I want to open the link with new window, then what should be parameter for:

addMenuItem(new menuItem("JavaScript Kit", "", "http://www.javascriptkit.com"));

expecting a positive response....

Thanks
Rajesh

razu21
11-07-2007, 09:02 AM
Can any one help me on it ?

I am not able to open linked page into a new window;
I have tried with this code but seems wrong.

addMenuItem(new menuItem("JavaScript Kit", "", "http://www.javascriptkit.com", "_blank"));

Please solve my this problem.

Thanks
Rajesh

ricrat51
01-22-2008, 07:33 PM
addMenuItem(new menuItem("JavaScript Kit", "", "code:window.open('http://www.javascriptkit.com')");

This will work, I think

jscheuer1
01-22-2008, 07:47 PM
Or even like:

addMenuItem(new menuItem("JavaScript Kit", "", "code:window.open('http://www.javascriptkit.com','_blank')"));

If you want to ensure a new window on each use. Without the target (window name) specified as _blank as shown above, once a new window is created it may be reused. If you want to force the new window to be reused, use a unique named new window:

addMenuItem(new menuItem("JavaScript Kit", "", "code:window.open('http://www.javascriptkit.com','myNewWin')"));