postheadericon 9. Write a JavaScript to show a pop up window with a message Hello and background color lime and with solid black border.

Note : Only Internet Explorer support the method window.createPopup(); 


Solution : 1 (Popup)



<html>
<head>
<title>EX-9: WTAD : www.bipinrupadiya.com</title>
<script type="text/javascript">

// createPopup() supported by IE only
function show_popup()
{
var p=window.createPopup();
var pbody=p.document.body;
pbody.style.backgroundColor="lime";
pbody.style.border="solid black 5px";
pbody.innerHTML="<h1> HELLO</h1><br><br><br><br>Click outside the pop-up to close.";
p.show(150,150,400,200,document.body);
}
</script>
</head>

<body>
<input type="button" value="click me" onclick="show_popup()" >
</body>

</html>





Solution : 2 (Window)



<html>
<head>
<title>EX-9: WTAD : www.bipinrupadiya.com</title>
</head>
<script type="text/javascript">
function show_popup()
{
myWindow = window.open("", "mywindow", "width=300,height=100,border:2px solid #ffffff;");
myWindow.moveTo(400, 400);
myWindow.document.write('<h1>HELLO!</h1>');
myWindow.document.bgColor = "#BFFF00";
}
</script>
<body>
<input type="button" value="click me" onclick="show_popup()" >
</body>
</html>

0 comments:

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.