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 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2011
    Posts
    15
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Onclick with more than one parameter

    Hi

    I have this code which works fine:

    Code:
    <td class="Content_TD" onclick="_gaq.push(['_trackEvent', 'navigation ', 'link', 'blocks']);  window.open('http://www.google.dk/');">

    But I dont now the parameters instead of window.open, if I want it to open on top. Can somebody please help me?


    Thanks in advance


    Claus

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Hi Claus,

    Good day!

    You can use the top and left parameters so the window would open on the top/left values you sent:
    Code:
    window.open('http://www.google.dk/','window_name','width=300,height=300,top=10,left=300');
    To center the pop-up, please find these links useful:
    http://www.java2s.com/Code/JavaScrip...ndcenterit.htm
    http://www.irt.org/script/1316.htm
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New Coder
    Join Date
    Jun 2011
    Posts
    15
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rangana View Post
    Hi Claus,

    Good day!

    You can use the top and left parameters so the window would open on the top/left values you sent:
    Code:
    window.open('http://www.google.dk/','window_name','width=300,height=300,top=10,left=300');
    To center the pop-up, please find these links useful:
    http://www.java2s.com/Code/JavaScrip...ndcenterit.htm
    http://www.irt.org/script/1316.htm
    First, thanks for your help

    Sorry I might have misunderstood myself. The code I have opens in a new tab. I just want it to open in the same tab/window Sorry

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    ...then use: location.href='http://www.google.dk/' instead of that window.open()
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • Users who have thanked rangana for this post:

    Cltornes (10-06-2011)

  • #5
    New Coder
    Join Date
    Jun 2011
    Posts
    15
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rangana View Post
    ...then use: location.href='http://www.google.dk/' instead of that window.open()
    Thank you very much It is very kind of you helping me.


  •  

    Posting Permissions

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