Results 1 to 8 of 8

Thread: jsDOMenu: Target problem

  1. #1
    Join Date
    Nov 2005
    Location
    Preußen
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default jsDOMenu: Target problem

    servus everybody!

    I've got a problem with my jsDOMenu-Script.
    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):
    Code:
    function createjsDOMenu() {
    mainMenu1 = new jsDOMenu(130);
    with (mainMenu1) {
    	addMenuItem(new menuItem("Myself", "", "myself.php"));
    	addMenuItem(new menuItem("JavaScript Kit", "", "http://www.javascriptkit.com"));
    	addMenuItem(new menuItem("Coding Forums", "", "http://www.codingforums.com"));
    }
    Please help!

  2. #2
    Join Date
    Nov 2005
    Location
    Preußen
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Does no one know??? It's important.. :'-(

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I really don't know but, according to the documentation it looks like -

    Instead of:

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

    Code:
    addMenuItem(new menuItem("Myself", "", "code:iframe_name.location.href='myself.php'"));
    where iframe_name is the name of the target iframe ex:

    HTML Code:
    <iframe name="iframe_name"></iframe>
    . This is a 'normal' type of link and will add to the history stack just like:

    Code:
    <a href="myself.php" target="iframe_name">Myself</a>
    would. If you want to avoid adding to the history stack, use:

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Nov 2005
    Location
    Preußen
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Wow it works! Thank you very much! I've tested the code:iframe_name.location.href='myself.php'! =)

  5. #5
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What about for new window

    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

  6. #6
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Target to new window

    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

  7. #7
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

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

    This will work, I think

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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')"));
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •