Write A Program To Design A Form To Accept Height and Width and 3 Buttons As "Create Window", "Move Window" and "Resize Window"
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