...

View Full Version : Onclick with more than one parameter



Cltornes
10-05-2011, 01:00 PM
Hi

I have this code which works fine:


<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

rangana
10-05-2011, 03:08 PM
Hi Claus,

Good day!

You can use the top and left parameters so the window would open on the top/left values you sent:


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/JavaScript/Window-Browser/Openawindowandcenterit.htm
http://www.irt.org/script/1316.htm

Cltornes
10-05-2011, 03:34 PM
Hi Claus,

Good day!

You can use the top and left parameters so the window would open on the top/left values you sent:


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/JavaScript/Window-Browser/Openawindowandcenterit.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 :)

rangana
10-05-2011, 03:41 PM
...then use: location.href='http://www.google.dk/' instead of that window.open()

Cltornes
10-06-2011, 08:27 AM
...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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum