N
Nicholas
Hello,
I'm new in Javascript and it seems I'm a bit stuck so if someone can help.
The problem is 4th button / function. I dont know how to talk to the opend
window, the thing with focus i wrote doesen't work so i didn't wrote code
for randomizeing location (this i know how to do).
Did i do something wrong?
window.opener works fine form the child window is there something similar
for control from parent window?
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function op(a,b)
{
window.open('first.html', 'first', 'width='+a+',height='+b);
}
function rresize()
{
var v = screen.width;
var h = screen.height;
var vx = Math.floor(Math.random()*1000);
var hx = Math.floor(Math.random()*1000);
if( vx > v){vx = v;}
if( hx > h){hx = h;}
op(vx,hx);
}
function rmove()
{
window.first.focus();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<input type="button" value="open new window 350 x 200"
onClick="op(350,200)"></br>
<input type="button" value="open new window 1/2 width and height of screen"
onClick="op(screen.width/2,screen.height/2)"></br>
<input type="button" value="open new window radnom size"
onClick="rresize()"></br></br>
<input type="button" value="focus and random move opend window"
onClick="rmove()"></br>
</BODY>
</HTML>
Thank you!
I'm new in Javascript and it seems I'm a bit stuck so if someone can help.
The problem is 4th button / function. I dont know how to talk to the opend
window, the thing with focus i wrote doesen't work so i didn't wrote code
for randomizeing location (this i know how to do).
Did i do something wrong?
window.opener works fine form the child window is there something similar
for control from parent window?
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function op(a,b)
{
window.open('first.html', 'first', 'width='+a+',height='+b);
}
function rresize()
{
var v = screen.width;
var h = screen.height;
var vx = Math.floor(Math.random()*1000);
var hx = Math.floor(Math.random()*1000);
if( vx > v){vx = v;}
if( hx > h){hx = h;}
op(vx,hx);
}
function rmove()
{
window.first.focus();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<input type="button" value="open new window 350 x 200"
onClick="op(350,200)"></br>
<input type="button" value="open new window 1/2 width and height of screen"
onClick="op(screen.width/2,screen.height/2)"></br>
<input type="button" value="open new window radnom size"
onClick="rresize()"></br></br>
<input type="button" value="focus and random move opend window"
onClick="rmove()"></br>
</BODY>
</HTML>
Thank you!