English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to open a new window using Java Script and embed a YouTube video in it, but the window always opens in the top left corner of the screen. How do I get it to center on the screen? Please go here and look at the page code:

www.sacnews.net/wintest1.html

2007-09-25 18:51:25 · 3 answers · asked by Joe B. 6 in Computers & Internet Programming & Design

3 answers

Give this a try:

replace this line of code:

window.open(URL, windowName, windowFeatures);

with:

myWindow = window.open(URL, windowName, windowFeatures);

...and add this line directly beneath it:

myWindow.moveTo(0,0);

...the first argument of the moveTo method, I believe, is the number of pixels you want to offset the the top position of the window, and the second argument is the left offset in pixels. I may have it reversed though. Play with it and see what happens.

2007-09-25 20:51:17 · answer #1 · answered by Steve R 3 · 1 0

Strictly conversing Java and Javascript are programming languages.What you downloaded is the Java Runtime ecosystem that's had to run Java applications. Javascript is a format of scripts used to accomplish particular applications in internet pages. verify your internet Browser's settings whether Javascript is enabled.

2016-10-20 00:25:23 · answer #2 · answered by mohr 4 · 0 0

function winOpen() {
var props = "scrollbar=no,addressbar=no,directories=no,width=200,height=200";
var win = window.open("temp.htm","",props);
win.moveTo(0,100);
win.movetTo(100,30);

}

just play around with win.moveTo and position it to where ever you want.

2007-09-25 20:48:37 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers