Hi, I have taken a look at the Prototype API and it says that
document.viewport.getDimensions() should return the size of the
viewport. I have created a simple page with a <div> with width of
100px and height of 100px.  I am hoping to alert the height of the
browser window, but I get the height of the div. I didn't understand
why the height of the div got alerted instead of the browser window.
It appears that I needed to add a DOCTYPE in order for
document.viewport.getDimensions() to work properly. Can anybody
explain why the DOCTYPE is required for Prototype to return the
correct viewport height? I have pasted the code that incorrectly
returns the height of the div instead of the viewport on pastie:
http://pastie.org/504692.

Just add a doctype and you get the correct result:
Replace <html>
with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>


I hope to use Prototype with Ext JS in the future, but it seems that
Prototype recommends/requires the use of DOCTYPES while Ext JS
recommends against using DOCTYPES in order to avoid bugs in IE.

- Paul K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to