--- loncom/interface/loncommon.pm 2007/09/24 23:29:53 1.587 +++ loncom/interface/loncommon.pm 2007/09/25 22:58:48 1.588 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.587 2007/09/24 23:29:53 raeburn Exp $ +# $Id: loncommon.pm,v 1.588 2007/09/25 22:58:48 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1094,30 +1094,58 @@ function init_geometry() { if (Geometry.init) { return }; Geometry.init=1; if (window.innerHeight) { - Geometry.getViewportHeight = function() { return window.innerHeight; }; + Geometry.getViewportHeight = function() { return window.innerHeight; }; + Geometry.getHorizontalScroll = function() { return window.pageXOffset; }; + Geometry.getVerticalScroll = function() { return window.pageYOffset; }; } else if (document.documentElement && document.documentElement.clientHeight) { Geometry.getViewportHeight = function() { return document.documentElement.clientHeight; }; + Geometry.getHorizontalScroll = + function() { return document.documentElement.scrollLeft; }; + Geometry.getVerticalScroll = + function() { return document.documentElement.scrollTop; }; } else if (document.body.clientHeight) { Geometry.getViewportHeight = function() { return document.body.clientHeight; }; + Geometry.getHorizontalScroll = + function() { return document.body.scrollLeft; }; + Geometry.getVerticalScroll = + function() { return document.body.scrollTop; }; } } +function getX(element) { + var x = 0; + while (element) { + x += element.offsetLeft; + element = element.offsetParent; + } + return x; +} +function getY(element) { + var y = 0; + while (element) { + y += element.offsetTop; + element = element.offsetParent; + } + return y; +} + + function resize_textarea(textarea_id,bottom_id) { init_geometry(); var textarea = document.getElementById(textarea_id); //alert(textarea); - var textarea_top = textarea.offsetTop; + var textarea_top = getY(textarea); var textarea_height = textarea.offsetHeight; var bottom = document.getElementById(bottom_id); - var bottom_top = bottom.offsetTop; + var bottom_top = getY(bottom); var bottom_height = bottom.offsetHeight; var window_height = Geometry.getViewportHeight(); - var fudge = 23; + var fudge = 23; var new_height = window_height-fudge-textarea_top-bottom_height; if (new_height < 300) { new_height = 300; @@ -1332,8 +1360,6 @@ sub domain_select { =over 4 -=cut - =item * multiple_select_form($name,$value,$size,$hash,$order) Returns a string containing a