Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to display the user's resolution on the screen

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
Hello,

I have a function that determines the user's resolution onLoad(). But I don't know how to display it on the screen in a TD. Can someone help me? The function is below.

Thank you

<script LANGUAGE="JavaScript">
<!-- Hide JavaScript from old browsers
function my_resolution()
{
if (screen.height >= 768 && screen.width >= 1024)
// alert('1024');
// resolution = "1024by768"; // or higher
else
// resolution = "800by600"; // or lower
}

</script>
 
Give as id to the target td eg <td id="resolution"></td> then, in your function, use getElementById() to grab a reference to the td, and use the innerHTML method to change the content of the td.

Search for further info.

Hope this helps.
 
Thanks for your post. Don't I need a variable or something inside that TD?

thanks
 
No - the id identifies the td
you will need a variable to hold the reference to the td in your script (eg var myTD = document.getElementById("whatever")) and still in your script you then use myTD.innerHTML = "some valid html to display the data".

Regards

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top