/*CSS样式*/
.showWindow:hover
{
color: #FF0000;
}
.win_bg
{
background: #CCC;
opacity: 0.2;
filter: alpha(opacity=20);
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 998;
}
.l
{
width: 80%;
height: 30px;
line-height: 30px;
margin-left: 20px;
}
.zhux
{
display: inline;
padding: 5px 10px;
background: #F7EF8C;
width: 50px;
height: 30px;
line-height: 30px;
text-align: center;
margin: 0 auto;
}
.right
{
text-align:right;
width:80%;
}
.padd_com
{
margin-bottom:20px;
}
.topcss
{
margin-top:10px;
}
.subcss
{
display:inline;
background: #F7EF8C;
width: 50px;
height: 30px;
line-height: 30px;
text-align: center;
border:none;
}
.black
{
background-color:Black;
margin:5px 0px;
color:White;
}
.red
{
background-color:Red;
margin:5px 0px;
color:White;
}
.yellow{
background-color:Yellow;
margin:5px 0px;
}
.blue
{
background-color:Blue;
margin:5px 0px;
color:White;
}
.green
{
background-color:Green;
margin:5px 0px;
color:White;
}
.gray
{
background-color:Gray;
margin:5px 0px;
color:White;
}
.Aqua
{
background-color:Aqua;
margin:5px 0px;
color:White;
}
#shezhi_foot
{
clear:both;
width:100%;
height:20px;
}
.winTitle
{
background: #F7EF8C;
height: 20px;
line-height: 20px;
}
.winTitle .title_left
{
font-weight: bold;
color: #FFF;
padding-left: 5px;
float: left;
}
.winTitle .title_right
{
float: right;
}
.winTitle .title_right a
{
color: #000;
text-decoration: none;
}
.winTitle .title_right a:hover
{
text-decoration: underline;
color: #FF0000;
}
.winContent
{
line-height: 30px;
padding-left: 20px;
height: 30px;
margin-top: 8px;
}
.com_b
{
padding-top:10px;
padding-bottom:10px;
border-bottom:1px solid #d7d7d7;
}
.left
{
text-align:left;
}
#shezhi
{
width:400px;
margin:0 auto;
background-color:White;
}
.field
{
width: 150px;
}
#divwin
{
width: 280px;
height: 180px;
border: 2px solid #AEBBCA;
background: #fff;
z-index: 999;
}
JS代码
<style>
function showWindow() {
if (document.getElementById("divWin")) {
$("divWin").style.zIndex = 999;
$("divWin").style.display = "";
}
else {
var objWin = document.createElement("div");
objWin.id = "divWin";
objWin.style.position = "absolute";
objWin.style.top = "150px";
objWin.style.left = "400px";
objWin.style.width = "280px";
objWin.style.height = "180px";
objWin.style.border = "2px solid #AEBBCA";
objWin.style.background = "#FFF";
objWin.style.zIndex = 999;
document.body.appendChild(objWin);
}
if (document.getElementById("win_bg")) {
$("win_bg").style.zIndex = 998;
$("win_bg").style.display = "";
}
else {
var obj_bg = document.createElement("div");
obj_bg.id = "win_bg";
obj_bg.className = "win_bg";
document.body.appendChild(obj_bg);
}
var str = "";
str += '<div class="winTitle" onMouseDown="startMove(this,event)" onMouseUp="stopMove(this,event)"><span class="title_right"><a href="javascript:closeWindow()" title="单击关闭此窗口">关闭</a></span><br style="clear:right"/></div>'; //标题栏
str += '<div class="winContent"><%=tit%></div>'; //窗口内容
str += '<div class="winContent"><a class="zhux" href="index.aspx?qid=1">注销</a></div>';
$("divWin").innerHTML = str;
}
function closeWindow() {
$("divWin").style.display = "none";
$("win_bg").style.display = "none";
}
function $(o) {
return document.getElementById(o);
}
function startMove(o, e) {
var wb;
if (document.all && e.button == 1) wb = true;
else if (e.button == 0) wb = true;
if (wb) {
var x_pos = parseInt(e.clientX - o.parentNode.offsetLeft);
var y_pos = parseInt(e.clientY - o.parentNode.offsetTop);
if (y_pos <= o.offsetHeight) {
document.documentElement.onmousemove = function (mEvent) {
var eEvent = (document.all) ? event : mEvent;
o.parentNode.style.left = eEvent.clientX - x_pos + "px";
o.parentNode.style.top = eEvent.clientY - y_pos + "px";
}
}
}
}
function stopMove(o, e) {
document.documentElement.onmousemove = null;
}
function check() {
var um = document.getElementById("jiapu_name").value;
var ps = document.getElementById("jiapu_pw").value;
window.location.href = "login.aspx?jiapu_username2=" + um + "&jiapu_pw2=" + ps + "";
}
HTML代码
<a href="javascript:void(0)">
<img src="images/center.png" border="0" οnclick="javascript:showWindow()" alt="" /></a>