Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Link in new Window

    Hello,

    I find the right-click menu (http://www.javascriptkit.com/script/...lickmenu.shtml), very helpful. I am not able to have the links open in a new windwo and am looking for some assistance to solve this. I would appreciate if someone could point me in the right direction.

    Thank you very much for your time.
    Stefan H.

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    in the .js file there is a line does opening pages on click:
    Code:
    preitem+=("<a href='#' onmousedown='parent.window.location.href=\""+lnk+"\"'><img src='"+ico+"' width='16' height='16' class='ico'> "+txt+"</a>")

  • #3
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi V,

    I pretty much gave up to figure this one out before i posted...
    ...would you be able to provide me the resolution to solve my problem?

    As mentioned, i would like to open the links in a new window.

    Thank you.
    Stefan H.

  • #4
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, try change this:
    Code:
    preitem+=("<a href='#' onmousedown='target="_blank";target.window.location.href=\""+lnk+"\"'><img src='"+ico+"' width='16' height='16' class='ico'> "+txt+"</a>")
    change _blank to whateve name u want for the new window.

  • #5
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi V,

    I tried your suggestion without luck. I copy-pasted your code-line and did not change a thing. Actually, the right-click menu did not appear at all. If i deleted the " " around _blank, it came back with a script error msg.
    Error: '_blank' is undefined, Code: 0

    Any idea how i can get this 'going'?
    Thank you again.
    Stefan H.

  • #6
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry, I'm 100% newbie at JS, but try to move
    target="_blank";
    outside of that line (put it before that line)

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try
    Code:
    preitem+=("<a href='#' onmousedown='window.open(\""+lnk+"\");return false'><img src='"+ico+"'....
    or

    Code:
    preitem+=("<a href=\""+lnk+"\" target=\"_blank\"><img src='"+ico+"'....
    Last edited by PauletteB; 04-04-2003 at 03:22 PM.

  • #8
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello PauletteB,

    Thank you for your reply. I appreciate all help i can get. Unfortunately, both of your suggestions do notwork.

    <<
    preitem+=("<a href='#' onmousedown='window.open(\""+lnk+"\");return false'><img src='"+ico+"'....
    >>
    Does create an error 'Not implemented', code "0"

    <<
    preitem+=("<a href=\""+lnk+"\" target=\"_blank\"><img src='"+ico+"'....
    >>
    Does not seem to work at all.

    Would you have any other idea how i can get the link to open in a new window?

    Thank you so much for your time.
    Stefan H.

  • #9
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    V,

    Thank you for haning in there with me. I am list with this thing and unfortunately, your other suggestion did not work. any otehr idea?
    Stefan H.

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Think you can post the link to your test page?
    Also, do you have Norton, or other security / pop-up remover?

  • #11
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi PauletteB,

    The site i am working on is actually not out on the www. I have put a rather large reference database together and used a simple software for the 'web based' part of this database. I dont want to bore you with too many details, but some info may be helpful. The software i am using is Adobe PageMill, a rather old piece of work, but it is just enough to fit our needs when it goes to have our products, description, pictures, catalogs and so on at our fingertips. There are approx. 2500 files linked and cross referenced with approx. 130 'web sites'. One page has links out to the internet, which we use many times per hour. These links do open in a new window without a problem, but one does have to get to the 'web links' page. I would like to use this 'right-click' menu on the entry page to the database for the links we use most often. The links in the test file are the ones that came with the cut-n-paste script and do open just fine, but not in a new window. I am going to attach the test.html and the rightmenu.js as test.zip file.

    Oh, we use IE 6.x on WIN 2000, if that should matter at all.

    To answer your question. There is no pop-up remover or Norton. Any other web sites and links seem to be working. Links do open, and pop-ups do come through w/o problems.

    Thank you again so much for your time looking into this.
    Attached Files Attached Files
    Stefan H.

  • #12
    Regular Coder
    Join Date
    Feb 2003
    Location
    Helsinki, Finland
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    target="new"

    I'm also a noob but won't it work if you target itlogically like this:
    target=\"new\" ?

    That's all I can think up...

  • #13
    Regular Coder
    Join Date
    Jun 2002
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Stefan

    The script was written for IE to be opened in the parent. It cannot be simply edited to be opened in a new window.

    I, and likely the others posters, had based our replies on the one-liner: preitem+=("<a href....

    Sorry...

    Paulette

  • #14
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello Paulette,
    I sure appreciate the time you took to look into this for me. Unfortunately I know nothing about js programming and was kind of surprised what neat things one can do with it and was hoping I could use this little gimmick. Well, we can do without it I guess. I just thought it would be much easier to change the window location, just like it is in html.
    Once again, thank you.
    Stefan H.


  •  

    Posting Permissions

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