Css Exp 11 PDF Updated Tuesday
Css Exp 11 PDF Updated Tuesday
Experiment No. 11: Develop a webpage for placing the window on the
screen and working with child window
1. Write a program to create a child window from a parent window. Shift focus to child
window.
CODE:
<html>
<body>
<button onclick="myFunction()">Try</button>
<script>
function myFunction() {
var myWindow = window.open("", "", "width=200,height=100");
myWindow.document.write("<p>Ansari Abdullah-220402!</p>");
myWindow.focus();
}
</script>
</body>
</html>
OUTPUT:
Child.html
<html>
<head>
<title>
Child window
</title>
</head>
<body>
<p id="demo"></p>
<p>Ansari Abdullah-220402</p>
</body>
</html>
OUTPUT:
OUTPUT:
4. Write a Program to use the Browser Object (Window Object) in JavaScript. Use all
function related to window object.
CODE:
<html> <button
<body> onclick="f7()">ScrollBy</button>
<button onclick="f1()">Open <br><br>
</button><br><br> <button
<button onclick="f9()">Close</button><br
onclick="f2()">MoveTo</button>< >
br><br> <p>Ansari Abdullah-220402</p>
<button <script>
onclick="f3()">MoveBy</button> var myWindow;
<br><br> function f1() {
<button myWindow=window.open("",
onclick="f4()">ResizeTo</button> "myWindow", "width=200,
<br><br> height=100");
<button myWindow.document.write("<p>T
onclick="f5()">ResizeBy</button> his is 'myWindow'</p>");}
<br><br> function f2() {
<button myWindow.moveTo(500, 100);
onclick="f6()">ScrollTo</button> myWindow.focus();}
<br><br> function f3() {
myWindow.moveBy(250, 250);
myWindow.focus();}
function f4() { function f7() {
myWindow.resizeTo(250, 250); myWindow.scrollBy(200,200);}
myWindow.focus();} function f9() {
function f5() { myWindow.close();}
myWindow.resizeBy(250, 250); </script>
myWindow.focus();} </body>
function f6() { </html>
myWindow.scrollTo(200,200);}
OUTPUT:
OUTPUT: