以下に示すように: コードをコピーします コードは次のとおりです: <br> function alertWin(title, msg, w, h) { <br><br> var titleheight = "22px"; // 窗口标题高度 <br> var bordercolor = "#666699"; //窗口的边框颜色 <br> var titlecolor = "#FFFFFF"; // 窗口的标题颜色 <br> var titlebgcolor = "#666699"; // 窗口的标题背景色 <br> var bgcolor = "#FFFFFF"; // 内容背景色 <br> var iWidth = document.documentElement.clientWidth; //这个窗口的宽度 <br> var iHeight = document.documentElement.clientHeight; //这个窗口的高度 <br><br> //背景层的格式 <br> var bgObj = document.createElement("div"); <br><br> bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:" + iWidth + "px;height:" + Math.max(document.body.clientHeight, iHeight) + "px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:1000;"; <br><br> document.body.appendChild(bgObj); <br><br> var iframe2 = document.createElement("iframe"); <br> iframe2.style.cssText = "position:absolute; top:0px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000; z-index:1001; border-style:none; border-width:0px; border:0px;width:" + iWidth + "px;height:" + iHeight + "px"; <br> bgObj.appendChild(iframe2); <br><br> //创建一个弹出层 <br> var msgObj = document.createElement("div"); <br> //设置弹出的层的样式 <br> msgObj.style.cssText = "position:absolute;font:11px '宋体';top:" + (iHeight - h) / 2 + "px;left:" + (iWidth - w) / 2 + "px;width:" + w + "px;height:" + h + "px;text-align:center;border:1px solid " + bordercolor + ";background-color:" + bgcolor + ";padding:1px;line-height:22px;z-index:1001;"; <br> document.body.appendChild(msgObj); <br> //创建一个table用于容纳层上的内容 <br> var table = document.createElement("table"); <br> //将Table放到弹出层上 <br> msgObj.appendChild(table); <br> //设置table的格式 <br> table.style.cssText = "margin:0px;border:0px;padding:0px;"; <br> table.cellSpacing = 0; <br> //插入一行用于显示标题 <br> var tr = table.insertRow(-1); <br> //插入一个单元格用于容纳标题 <br> var titleBar = tr.insertCell(-1); <br> titleBar.style.cssText = "width:100%;height:" + titleheight + "px;text-align:left;padding:3px;margin:0px;font:bold 13px '宋体';color:" + titlecolor + ";border:1px solid " + bordercolor + ";cursor:move;background-color:" + titlebgcolor; <br> titleBar.style.paddingLeft = "10px"; <br> //设置标题 <br> titleBar.innerHTML = title; <br> //设置曾德拖动事件 <br> var moveX = 0; <br> var moveY = 0; <br> var moveTop = 0; <br> var moveLeft = 0; <br> var moveable = false; <br> var docMouseMoveEvent = document.onmousemove; <br> var docMouseUpEvent = document.onmouseup; <br> // 鼠标点击标题 <br> titleBar.onmousedown = function() { <br> var evt = getEvent(); <br> 移動可能 = true; <br> moveX = evt.clientX; <br> moveY = evt.clientY; <br> moveTop = parseInt(msgObj.style.top); <br> moveLeft = parseInt(msgObj.style.left); <br> // ネズミ标拖アニメーション <br> document.onmousemove = function() { <br> if (移動可能) { <br> var evt = getEvent(); <br> var x = moveLeft evt.clientX - moveX; <br> var y = moveTop evt.clientY - moveY; <br> if (x > 0 && (x w < iWidth) && y > 0 && (y h msgObj.style.left = x "px"; <br> msgObj.style.top = y "px"; <br> } <br> } <br> }; <br> document.onmouseup = function() { <br> if (移動可能) { <br> document.onmousemove = docMouseMoveEvent; <br> document.onmouseup = docMouseUpEvent; <br> 移動可能 = false; <br> moveX = 0; <br> moveY = 0; <br> moveTop = 0; <br> moveLeft = 0; <br> } <br> }; <br> } <br><br> //关闭按钮イベント <br> var closeBtn = tr.insertCell(-1); <br> closeBtn.style.cssText = "cursor:pointer; text-align:right;padding:2px;background-color:" titlebgcolor; <br> closeBtn.innerHTML = "<span style='font-size:15pt;color:" titlecolor ";'>×</span>"; <br> closeBtn.onclick = function() { <br> document.body.removeChild(bgObj); <br> document.body.removeChild(msgObj); <br> }<br><br> // ポップアップ メッセージ ウィンドウの内容 <br> var msgBox = table.insertRow(-1).insertCell(-1) "; <br> msgBox.colSpan = 2; 🎜> var nameLable = nameBox.insertCell(-1); <br> nameLable.innerHTML = "<br/>ID 証明書番号を入力してください: <br/>"; var nametext = nameBox.insertCell(-1) ; <br> nametext.style.cssText = "font:12pt '宋体';text-align:Left; margin- left:0px"; <br> nametext.innerHTML = "<br/><input type= 'text' value='' id='modalName'/> <br/>"; <br> //レイヤー上のアクションボタンのコンテンツ <br> var submitBox = table.insertRow(-1) ; <br> var submitBtn = submitBox.insertCell(-1); <br> submitBtn.style.cssText = "text-align: center;"; <br> submitBtn.innerHTML = " <br/><input type='Button' value='OK' id='saveHeader'onclick='return GetCark ()' /><br/>"; <br> function getEvent() { <br> <br>