black
06-27-2003, 02:51 AM
guys i need your help here~
my code called a cute floating window and it kept bounce within its parent window, it worked perfect with its location property empty but refused move even one pace if location has any contents. here is my code:
function wMove()
{
if ((w_x + w_width + w_xd) >= screen.availWidth || (w_x + w_xd) <= 0)
{
w_xd = - w_xd;
}
if ((w_y + w_height + w_yd) >= screen.availHeight || (w_y + w_yd) <= 0)
{
w_yd = - w_yd;
}
w_x += w_xd;
w_y += w_yd;
w.moveTo(w_x, w_y);
}
var w_width = 100;
var w_height = 100;
var w_x = 0;
var w_y = 0;
var w_delay = 20;
var w_url = "http://www.webdeveloper.com";
var w_name = "floatingWindow";
var w_xd = 2;
var w_yd = 2;
var w = window.open(w_url, w_name, "width = " + w_width + ", height = " + w_height);
w.moveTo(w_x, w_y);
setInterval(wMove, w_delay);
the code only works when this line: var w = window.open(w_url, w_name, "width = " + w_width + ", height = " + w_height); is converted to something like this: var w = window.open("", w_name, "width = " + w_width + ", height = " + w_height);, what's up ??? :confused:
my code called a cute floating window and it kept bounce within its parent window, it worked perfect with its location property empty but refused move even one pace if location has any contents. here is my code:
function wMove()
{
if ((w_x + w_width + w_xd) >= screen.availWidth || (w_x + w_xd) <= 0)
{
w_xd = - w_xd;
}
if ((w_y + w_height + w_yd) >= screen.availHeight || (w_y + w_yd) <= 0)
{
w_yd = - w_yd;
}
w_x += w_xd;
w_y += w_yd;
w.moveTo(w_x, w_y);
}
var w_width = 100;
var w_height = 100;
var w_x = 0;
var w_y = 0;
var w_delay = 20;
var w_url = "http://www.webdeveloper.com";
var w_name = "floatingWindow";
var w_xd = 2;
var w_yd = 2;
var w = window.open(w_url, w_name, "width = " + w_width + ", height = " + w_height);
w.moveTo(w_x, w_y);
setInterval(wMove, w_delay);
the code only works when this line: var w = window.open(w_url, w_name, "width = " + w_width + ", height = " + w_height); is converted to something like this: var w = window.open("", w_name, "width = " + w_width + ", height = " + w_height);, what's up ??? :confused: