clock.html
<html>
<head><title> MoveBy</title>
</head>
<script>
var x=0;
var y=0;
function openwin()
{
mywin=window.open("","","width=10,height=10");
}
function closewin()
{
if(mywin)
{
mywin.close();
}
}
function movebywin()
{
if(x<600 && y==0)
{
x=x+200;
if(x==600)
{
y=y+100;
}
}
else if(x==600 && y<=300)
{
y=y+100;
if(y==300)
{
x=x-200;
}
}
else if( x<=600 && y==300)
{
x=x-200;
if(x==0)
{
y=y-100;
}
}
else if(x==0 && y<=300)
{
y=y-100;
if(y==0)
{
x=x+200;
}
}
mywin.moveTo(x,y);
mywin.focus();
}
</script>
<body>
<input type="button" value="Open window" onclick="openwin()">
<input type="button" value="Move" onclick="movebywin()">
<input type="button" value="Close" onclick="closewin()">
</body>
</html>
<html>
<head><title> MoveBy</title>
</head>
<script>
var x=0;
var y=0;
function openwin()
{
mywin=window.open("","","width=10,height=10");
}
function closewin()
{
if(mywin)
{
mywin.close();
}
}
function movebywin()
{
if(x<600 && y==0)
{
x=x+200;
if(x==600)
{
y=y+100;
}
}
else if(x==600 && y<=300)
{
y=y+100;
if(y==300)
{
x=x-200;
}
}
else if( x<=600 && y==300)
{
x=x-200;
if(x==0)
{
y=y-100;
}
}
else if(x==0 && y<=300)
{
y=y-100;
if(y==0)
{
x=x+200;
}
}
mywin.moveTo(x,y);
mywin.focus();
}
</script>
<body>
<input type="button" value="Open window" onclick="openwin()">
<input type="button" value="Move" onclick="movebywin()">
<input type="button" value="Close" onclick="closewin()">
</body>
</html>
No comments:
Post a Comment