I am trying to include the open new window page related functionalities in the parent Html page. I events how to call from child to parent pages. The sample below code I am trying to do achieve that but it is not able to come output as expected.
What can I do to resolve this?
<!DOCTYPE html>
<html>
<body>
<p>Click the button to write some text in the new window and the source (parent) window.</p>
<button onclick="myFunction1()">Try it</button>
<script>
function myFunction1() {
var myWindow = window.open("", "myWindow", "width=200,height=100");
myWindow.document.write("<html oncontextmenu='return false;'><head> <meta name='viewport' content='width=device-width, initial-scale=1'> <style> </style></head><body onload='closeWindow()' onresize='myFunction()'><div style='width:1020px;height:750px;background-color:transparent;position:absolute;top:0px;max-width: 100%;'></body></html>");
}
function closeWindow(){
alert('closeWindow');
}
function myFunction() {
alert('myFunction');
}
document.onkeypress = function (event) {
event = (event || window.event);
return keyFunction(event);
function keyFunction(event){
alert('keyFunction');
}
</script>
</body>
</html>
Comments
Post a Comment