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:
Get the Height and Width of web Page and browser Window

Daily Test with Code Example

Which tag is used to include external CSS file in web page?
<body> <script> <link>
<link href="/templ/style.css" rel="stylesheet" type="text/css" />
Which CSS property sets the text size?
font-weight text-decoration font-size
h2 {
  font-size: 1em;
Indicate the JavaScript property that can add HTML code into an element.
text value innerHTML
document.getElementById("someID").innerHTML = "HTML content";
Click on the function that returns the number of characters of a string in PHP.
count() strlen() stristr()
$str = "";
$nr_chr = strlen($str);
echo $nr_chr;       // 22

Last accessed pages

  1. JavaScript Chronometer / Stopwatch (2570)
  2. The Stage, Panels and Tools in Flash (3489)
  3. Crab And Pearl (1354)
  4. Convert XML to JSON in PHP (3140)
  5. Get Attribute (ID, Class, Name, Title, Src) with jQuery (26596)

Top accessed pages

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