0% found this document useful (0 votes)
29 views

Write A Program To Design A Form To Accept Height and Width and 3 Buttons As "Create Window", "Move Window" and "Resize Window"

The document contains code to create three buttons that open and manipulate windows. The "Create Window" button uses the window.open method to create a new window called "myWindow" with defined width and height. The "Move Window" button uses the moveBy method to shift the previously created "myWindow" over 250 pixels horizontally and vertically. The "Resize window" button uses the resizeBy method to enlarge the size of another window called "ReWindow" by 250 pixels width and height each time the button is clicked.

Uploaded by

sakshi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Write A Program To Design A Form To Accept Height and Width and 3 Buttons As "Create Window", "Move Window" and "Resize Window"

The document contains code to create three buttons that open and manipulate windows. The "Create Window" button uses the window.open method to create a new window called "myWindow" with defined width and height. The "Move Window" button uses the moveBy method to shift the previously created "myWindow" over 250 pixels horizontally and vertically. The "Resize window" button uses the resizeBy method to enlarge the size of another window called "ReWindow" by 250 pixels width and height each time the button is clicked.

Uploaded by

sakshi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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