Jump to content

m.s_shohan

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by m.s_shohan

  1. Hi, I am learning javaScript and jQuery. In this code, I saw that if I keep the script in the head section it doesn't work.But if I keep the script in the body section it works. Can you please tell me why this happens? Thank you in advance.

    <!DOCTYPE html>
    <html>
    <body>
    
    <h3>Your Screen:</h3>
    
    <div id="demo"></div>
    
    <script>
    var txt = "";
    txt += "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>";
    txt += "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight + "</p>";
    txt += "<p>Color depth: " + screen.colorDepth + "</p>";
    txt += "<p>Color resolution: " + screen.pixelDepth + "</p>";
    
    document.getElementById("demo").innerHTML = txt;
    </script>
    
    </body>
    </html>
    
×
×
  • Create New...