|
function showDropDown(element, win_content) {
var oPopup = window.createPopup();
oPopup.document.body.innerHTML = win_content.innerHTML;
var items = new Array();
var list = oPopup.document.getElementsByTagName('span');
for(var i = 0; i < list.length; i++)
{
var item = list[i].innerHTML;
list[i].onclick = new Function("span_value(\"" + item + "\",\"" + element.id + "\" );")
}
var xdiv = oPopup.document.getElementsByTagName('div');
var str_divheight = xdiv[0].style.height;
var win_height = (str_divheight.substr(0,str_divheight.length -2))*1;
var str_divwidth = xdiv[0].style.width;
var divwidth = (str_divwidth.substr(0,str_divwidth.length -2))*1;
var srcollbar_width = getScrollBarWidth();
var win_width = divwidth + srcollbar_width;
var xheight = element.offsetHeight ;
oPopup.show(0, xheight, win_width, win_height, element);
}
function span_value(text_value, txtbox) {
document.getElementById(txtbox).setAttribute("value",text_value);
}
function getScrollBarWidth () {
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild (inner);
document.body.appendChild (outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) w2 = outer.clientWidth;
document.body.removeChild (outer);
return (w1 - w2)*2;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.