0

I am trying to create an html game on the pop up window. When the user clicks on the button, they should be able to view the game on a pop up javascript window, another informal name for this could be game in a game. My code is as follows:

HTML -

<input type="image" id="buttonimage1" alt="game1"
    src="canon.png" onclick="openWindow();">

JavaScript

function openWindow()
 {
    newWindow = window.open("", null, "height=300,width=500,status=yes,toolbar=no,menubar=no,location=no");   
}

I would like to implement the html js game code for tictactoe (XandO) given on this website https://embed.plnkr.co/plunk/NAOYuT on my pop up window. Do I include it as a new div and add it to my html code for openWindow? Or are there any other ways to do it?

No_Name
  • 155
  • 2
  • 14

1 Answers1

0

So I figured the answer through innerHTML as in:

newWindow.document.body.innerHTML = "HTML";

Another way is by:

newWindow.document.write();

This is the link to the post on stackoverflow which explains document.write in detail : Open window in JavaScript with HTML inserted

No_Name
  • 155
  • 2
  • 14