Page sizes

If you want to get the total Height and Width of the page content in JavaScript, you can use this code:
// gets the total height of the page content
var page_height = document.body.offsetHeight ? document.body.offsetHeight : document.height;

// gets the total width of the page content
var page_width = document.body.offsetWidth ? document.body.offsetWidth : document.width;

// Test
alert('Height: '+ page_height +' px \nWidth: '+ page_width +' px');
- Example:

Window sizes

This function, getWindowSize(), can be used to get the Height and Width of the browser window, in pixels:
// Returns an Array with the 'height' and 'width' of the browser window, in pixels
function getWindowSize() {
 // from:
  var win_size = new Array;
  if (self.innerHeight) {
    win_size['height'] = self.innerHeight;
    win_size['width'] = self.innerWidth;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    win_size['height'] = document.documentElement.clientHeight;
    win_size['width'] = document.documentElement.Width;
  } else if (document.body) {
    win_size['height'] = document.body.clientHeight;
    win_size['width'] = document.body.clientWidth;
  return win_size;

// Test: gets the array with the window sizes
var win_dim = getWindowSize();
alert('Height: '+ win_dim['height'] +' px \nWidth: '+ win_dim['width'] +' px');
- Example:

Daily Test with Code Example

Which tag can be used to create input text field in web page?
<form> <input> <div>
<input type="text" name="a_name" value="val" />
Which CSS property displays the text in a small-caps font?
display font-variant font-style
h3 {
  font-variant: small-caps;
What instruction displays a notice box with a message inside it, in JavaScript?
for() Date() alert()
var msg = "Visit";
Indicate the PHP code used to get the users IP.
echo $ip;
Get the Height and Width of web Page and browser Window

Last accessed pages

  1. Multiple Select Dropdown List with JavaScript (4468)
  2. JavaScript Course - Free lessons (8170)
  3. Voting Poll System script PHP-AJAX (3756)
  4. innerHTML and outerHTML to Get and Replace HTML content (6535)
  5. $_GET, $_POST and $_REQUEST Variables (15824)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (31782)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (25931)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (24861)
  4. Read Excel file data in PHP - PhpExcelReader (24048)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (21662)