Jump to content

Can anyone find an error with this code It is not working 

<hmtl>

  <head>
  </head>

  <body>
    <button>Play now</button>
    <script>
      var urlobj = new window.URL(window.location.herf);
      var url = "https://coolmethgames69420.up.railway.app";
      if (url) {
        var win;

        document.querySelector('button').onclick = function() {
          if (win) {
            win.focus();
          } else {
            win = window.open();
            win.document.body.style.margin = '0';
            win.document.body.style.height = '100vh';
            var iframe = win.document.createElement('iframe');
            iframe.style.border = 'none';
            iframe.style.width = '100%';
            iframe.style.height = '1005';
            iframe.style.margin = '0';
            iframe.src = url;
            win.document.body.appendChild(iframe);
          }
          document.querySelecotr('button').style.background = 'grey';
          document.querySelecotr('button').innerHTML = "Play Now";
        };
      }

    </script>
  </body>
</hmtl>
 

Link to comment
https://linustechtips.com/topic/1485645-code-html-not-working/
Share on other sites

Link to post
Share on other sites

I'm on my phone so I can't fully check, but I think it's because you spelt selector wrong here:

 

document.querySelecotr('button').style.background = 'grey';
          document.querySelecotr('button').innerHTML = "Play Now";

 

You did spell it right on the earlier party here:

 

document.querySelector('button').onclick = function()

 

There might be more and I can look later also, but I hope that helps for now.

Link to comment
https://linustechtips.com/topic/1485645-code-html-not-working/#findComment-15782419
Share on other sites

Link to post
Share on other sites

  • 4 weeks later...

- its not "<hmtl>", its "<html>"

- its not "window.location.herf" , its "window.location.href"

- its not "document.querySelecotr", its "document.querySelector"

- its not "iframe.style.height = '1005'", the unit should be like "1005px"

 

will this help you?

 

hey! i know to use a computer

Link to comment
https://linustechtips.com/topic/1485645-code-html-not-working/#findComment-15818845
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×