<html>
??? <style>
??? ??? body {
??? ??? ??? display:inline-block;
??? ??? ??? overflow:scroll;
??? ??? ??? width:2000px;
??? ??? }
??? </style>
??? <div style="width:1000px;">
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjkthiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk thiisdjk <br />
??? ??? <button>Btn</button>
??? ???
??? </div>
??? ???
??? <script>
??? ??? var btns = document.getElementsByTagName('BUTTON');
??? ??? for(var i = 0 ; i < btns.length ; i++) {
??? ??? ??? btns[i].onclick = thickbox;
??? ??? }
??? ??? function thickbox() {
??? ??? ??? var aboveDiv = document.getElementById('above');
??? ??? ??? if(!aboveDiv) {
??? ??? ??? ??? aboveDiv = document.createElement('DIV');
??? ??? ??? ??? document.body.appendChild(aboveDiv);
??? ??? ??? ??? aboveDiv.id = 'above';
??? ??? ??? ??? for(var i = 0 ; i < 5 ; i++) {
??? ??? ??? ??? ??? var pa = document.createElement('p');
??? ??? ??? ??? ??? pa.appendChild(document.createTextNode('This is a paragraphThis is a paragraphThis is a paragraphThis is a paragraph'));
??? ??? ??? ??? ??? aboveDiv.appendChild(pa);
??? ??? ??? ??? }
??? ??? ??? ??? aboveDiv.style.position = 'absolute';
??? ??? ??? ??? aboveDiv.style.zIndex = 1000;
??? ??? ??? ??? aboveDiv.style.border = 'solid 1px blue';
??? ??? ??? ??? aboveDiv.style.backgroundColor = 'green';
??? ??? ??? }
??? ??? ??? var posLeft = document.body.scrollLeft? + (getSize().width - aboveDiv.offsetWidth) /2;
??? ??? ??? var posTop = document.body.scrollTop + (getSize().height - aboveDiv.offsetHeight ) / 2;
??? ??? ??? aboveDiv.style.left = posLeft + 'px';
??? ??? ??? aboveDiv.style.top = posTop + 'px';
??? ??? ??? var div = document.getElementById('thickBox');
??? ??? ??? if(!div) {
??? ??? ??? ??? div = document.createElement('DIV');
??? ??? ??? ??? document.body.appendChild(div);
??? ??? ??? ??? div.id='thickBox';
??? ??? ??? ??? div.style.backgroundColor = 'black';
??? ??? ??? ??? div.style.filter = 'alpha(opacity=50)';
??? ??? ??? ??? div.style.room = 1;
??? ??? ??? ??? div.style.display = 'inline-block';
??? ??? ??? ??? div.style.opacity = '0.5';
??? ??? ??? }
??? ??? ??? var sizeObj = getScreenSize();
??? ??? ??? var width = sizeObj.width ;
??? ??? ??? var height = sizeObj.height;
??? ??? ??? div.style.position = 'absolute';
??? ??? ??? div.style.left = '0px';
??? ??? ??? div.style.top = '0px';
??? ??? ??? div.style.width = width + 'px';
??? ??? ??? div.style.height = height + 'px';
??? ??? ??? div.style.zIndex = 999;
??? ??? }
??? ???
??? ??? function getSize() {
??? ??? ??? return {
??? ??? ??? ??? 'width' : window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
??? ??? ??? ??? 'height' : window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
??? ??? ??? };
??? ??? }
??? ???
??? ??? function getScreenSize() {
??? ??? ??? return {
??? ??? ??? ??? 'width':document.body.scrollWidth,
??? ??? ??? ??? 'height':document.body.scrollHeight
??? ??? ??? };
??? ??? }
??? ???
??? ??? function getPageSize(){
??? ??? ??? var xScroll, yScroll;
??? ??? ??? if (window.innerHeight && window.scrollMaxY) {???
??? ??? ??? ??? xScroll = document.body.scrollWidth;
??? ??? ??? ??? yScroll = window.innerHeight + window.scrollMaxY;
??? ??? ??? } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
??? ??? ??? ??? xScroll = document.body.scrollWidth;
??? ??? ??? ??? yScroll = document.body.scrollHeight;
??? ??? ??? } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
??? ??? ??? ??? xScroll = document.body.offsetWidth;
??? ??? ??? ??? yScroll = document.body.offsetHeight;
??? ??? ??? }
??? ??? ???
??? ??? ??? var windowWidth, windowHeight;
??? ??? ??? if (self.innerHeight) {??? // all except Explorer
??? ??? ??? ??? windowWidth = self.innerWidth;
??? ??? ??? ??? windowHeight = self.innerHeight;
??? ??? ??? } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
??? ??? ??? ??? windowWidth = document.documentElement.clientWidth;
??? ??? ??? ??? windowHeight = document.documentElement.clientHeight;
??? ??? ??? } else if (document.body) { // other Explorers
??? ??? ??? ??? windowWidth = document.body.clientWidth;
??? ??? ??? ??? windowHeight = document.body.clientHeight;
??? ??? ??? }???
??? ??? ???
??? ??? ??? // for small pages with total height less then height of the viewport
??? ??? ??? if(yScroll < windowHeight){
??? ??? ??? ??? pageHeight = windowHeight;
??? ??? ??? } else {
??? ??? ??? ??? pageHeight = yScroll;
??? ??? ??? }
??? ??? ??? // for small pages with total width less then width of the viewport
??? ??? ??? if(xScroll < windowWidth){???
??? ??? ??? ??? pageWidth = windowWidth;
??? ??? ??? } else {
??? ??? ??? ??? pageWidth = xScroll;
??? ??? ??? }
??? ??? ??? arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
??? ??? ??? return arrayPageSize;
??? ??? }
??? </script>
</html>
详细解决方案
容易的thickbox
热度:112 发布时间:2012-11-22 00:16:41.0