日期:2014-05-16  浏览次数:20586 次

js关闭按钮放右边
function insertZoomHTML() {

var inSpinbox = document.createElement("div");
inSpinbox.setAttribute('id', 'ZoomSpin');
inSpinbox.style.position = 'absolute';
inSpinbox.style.left = '10px';
inSpinbox.style.top = '10px';
inSpinbox.style.visibility = 'hidden';
inSpinbox.style.zIndex = '525';
inBody.insertBefore(inSpinbox, inBody.firstChild);

var inSpinImage = document.createElement("img");
inSpinImage.setAttribute('id', 'SpinImage');
inSpinImage.setAttribute('src', zoomImagesURI+'zoom-spin-1.png');
inSpinbox.appendChild(inSpinImage);


var inZoombox = document.createElement("div");
inZoombox.setAttribute('id', 'ZoomBox');

inZoombox.style.position = 'absolute'; 
inZoombox.style.left = '10px';
inZoombox.style.top = '10px';
inZoombox.style.visibility = 'hidden';
inZoombox.style.zIndex = '499';

inBody.insertBefore(inZoombox, inSpinbox.nextSibling);

var inImage1 = document.createElement("img");
inImage1.onclick = function (event) { zoomOut(this, event); return false; };
inImage1.setAttribute('src',zoomImagesURI+'spacer.gif');
inImage1.setAttribute('id','ZoomImage');
inImage1.setAttribute('border', '0');
inImage1.setAttribute('style', '-webkit-box-shadow: '+shadowSettings+'0.0)');
inImage1.style.display = 'block';
inImage1.style.width = '10px';
inImage1.style.height = '10px';
inImage1.style.cursor = 'pointer'; // -webkit-zoom-out?
inZoombox.appendChild(inImage1);

var inClosebox = document.createElement("div");
inClosebox.setAttribute('id', 'ZoomClose');
inClosebox.style.position = 'absolute';

if (browserIsIE) {
inClosebox.style.left = '-1px';
inClosebox.style.top = '0px';
} else {
inClosebox.style.left = '-15px';
inClosebox.style.top = '-15px';
}

inClosebox.style.visibility = 'hidden';
inZoombox.appendChild(inClosebox);

var inImage2 = document.createElement("img");
inImage2.onclick = function (event) { zoomOut(this, event); return false; };
inImage2.setAttribute('src',zoomImagesURI+'closebox.png');
inImage2.setAttribute('width','30');
inImage2.setAttribute('height','30');
inImage2.setAttribute('border','0');
inImage2.style.cursor = 'pointer';
inClosebox.appendChild(inImage2);

if (! document.getElementById('ZoomImage').style.webkitBoxShadow && ! browserIsIE) {


var inFixedBox = document.createElement("div");
inFixedBox.setAttribute('id', 'ShadowBox');
inFixedBox.style.position = 'absolute'; 
inFixedBox.style.left = '50px';
inFixedBox.style.top = '50px';
inFixedBox.style.width = '100px';
inFixedBox.style.height = '100px';
inFixedBox.style.visibility = 'hidden';
inFixedBox.style.zIndex = '498';
inBody.insertBefore(inFixedBox, inZoombox.nextSibling);


var inShadowTable = document.createElement("table");
inShadowTable.setAttribute('border', '0');
inShadowTable.setAttribute('width', '100%');
inShadowTable.setAttribute('height', '100%');
inShadowTable.setAttribute('cellpadding', '0');
inShadowTable.setAttribute('cellspacing', '0');
inFixedBox.appendChild(inShadowTable);

var inShadowTbody = document.createElement("tbody"); // Needed for IE (for HTML4).
inShadowTable.appendChild(inShadowTbody);

var inRow1 = document.createElement("tr");
inRow1.style.height = '25px';
inShadowTbody.appendChild(inRow1);

var inCol1 = document.createElement("td");
inCol1.style.width = '27px';
inRow1.append