Template:Imperial/09/TemplateTop
From 2009.igem.org
(Difference between revisions)
Line 10: | Line 10: | ||
if (typeof window.innerWidth != 'undefined') | if (typeof window.innerWidth != 'undefined') | ||
{ | { | ||
- | viewportwidth = window.innerWidth | + | viewportwidth = window.innerWidth; |
- | viewportheight = window.innerHeight | + | viewportheight = window.innerHeight; |
} | } | ||
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) | // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) | ||
- | + | else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) | |
- | else if (typeof document.documentElement != 'undefined' | + | |
- | + | ||
- | + | ||
{ | { | ||
- | viewportwidth = document.documentElement.clientWidth | + | viewportwidth = document.documentElement.clientWidth; |
- | viewportheight = document.documentElement.clientHeight | + | viewportheight = document.documentElement.clientHeight; |
} | } | ||
Line 28: | Line 25: | ||
else | else | ||
{ | { | ||
- | viewportwidth = document.getElementsByTagName('body')[0].clientWidth | + | viewportwidth = document.getElementsByTagName('body')[0].clientWidth; |
- | viewportheight = document.getElementsByTagName('body')[0].clientHeight | + | viewportheight = document.getElementsByTagName('body')[0].clientHeight; |
} | } | ||
document.write('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>'); | document.write('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>'); |
Revision as of 14:21, 28 September 2009