Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Practica 9

/* 1. Write a program to design a form to accept height and


width and 3 buttons as “Create Window”, “Move Window” and
“Resize window” */

<html>
<body>            
<!--moveBy-->
 <b>Create Window</b> <br>
 <button onclick="CreateWin()">Create "myWindow"</button>
 <button onclick="moveWin()">Move "myWindow"</button>    
 <br> <br>
             
<!--resizeBy-->
 <b>Resize Window by 250px</b> <br>
 <b>Tip:</b> Press the "Resize window" multiple times <br>
 <button onclick="sizeWin()">Create window</button>
 <button onclick="resizeWin()">Resize window</button>
   
           
<!--Change Content-->
<p>
<b>To Change Contents of Window : </b> <br>
<input type="button" value="Window A"
onclick="ChangeContent('youtube.png')" />
<input type="button" value="Window B"
onclick="ChangeContent('JS.png')" />
</p>
                     
<script>
//moveBy
var myWindow;
function CreateWin()
{ myWindow = window.open("", "myWindow", "width=200,
height=100");
myWindow.document.write("<p>This is
'myWindow'</p>");
}

function moveWin()
{ myWindow.moveBy(250, 250);
myWindow.document.write("<p>Window is moved'</p>");
myWindow.focus();
}
Practica 9

//resizeBy
var ReWindow;
function sizeWin()
{ ReWindow =
window.open("https://classroom.google.com/",
"ReWindow", "width=100, height=100");
}
function resizeWin()
{ ReWindow.resizeBy(250, 250);
ReWindow.focus();
}

//change content
function ChangeContent(Ad)
{ content = window.open(Ad, "Admin", "resizeable=1",
"height=50", "width=50", 'left=100', 'top=180');
}
</script>
       
</body>
</html>
Practica 9

You might also like