今天发的第五个贴了,你们都没有给解决了,白送你们那么多分,把分都压上了。

心灵彩虹 2011-02-24 11:59:35
这个功能是弹出层,运行弹出层以后,层里面的textbox不能输入了,js的问题,哪位帮忙解决一下,分都给你了。感谢,我今天发了5个帖子了,花了200分都没有人解决了。


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DOM_text01</title>
<style type="text/css">
body,span,div,td{font-size:12px;line-height:1.5em;color:#849BCA;}
#bodyL{
float:left;
width:84px;
margin-right:2px;
}
a.od{
width:80px;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
border: 2px solid #849BCA;
display:block;
color:#547BC9;
float:left;
text-decoration:none;
margin-top:2px;
}
a.od:link{
background:#EEF1F8;
}
a.od:visited{
background:#EEF1F8;
}
a.od:hover{
background:#EEE;
}
a.od:active{
background:#EEE;
}
#fd{
width:500px;
height:200px;
background:#EDF1F8;
border: 2px solid #849BCA;
margin-top:2px;
margin-left:2px;
float:left;
overflow:hidden;
position:absolute;
left:0px;
top:0px;
cursor:move;
float:left;
/*filter:alpha(opacity=50);*/

}
.content{
padding:10px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="bodyL">
<a href="#" class="od" onclick = "show('fd');return false;">
[打开层]
</a>
<a href="#" class="od" onclick = "closeed('fd');return false;">
[关闭层]
</a>
</div>
<div id="fd" style="display:none;filter:alpha(opacity=100);opacity:1;">
<div class="content">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


</div>
</div>

<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id) {/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function() { openx(o, 500) }, 10);
}
function openx(o, x) {/*--打开x--*/
var cx = parseInt(o.style.width);
if (cx < x) {
o.style.width = (cx + Math.ceil((x - cx) / 5)) + "px";
}
else {
clearInterval(prox);
proy = setInterval(function() { openy(o, 200) }, 10);
}
}
function openy(o, y) {/*--打开y--*/
var cy = parseInt(o.style.height);
if (cy < y) {
o.style.height = (cy + Math.ceil((y - cy) / 5)) + "px";
}
else {
clearInterval(proy);
}
}
function closeed(id) {/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
if (o.style.display == "block") {
proyc = setInterval(function() { closey(o) }, 10);
}
}
function closey(o) {/*--打开y--*/
var cy = parseInt(o.style.height);
if (cy > 0) {
o.style.height = (cy - Math.ceil(cy / 5)) + "px";
}
else {
clearInterval(proyc);
proxc = setInterval(function() { closex(o) }, 10);
}
}
function closex(o) {/*--打开x--*/
var cx = parseInt(o.style.width);
if (cx > 0) {
o.style.width = (cx - Math.ceil(cx / 5)) + "px";
}
else {
clearInterval(proxc);
o.style.display = "none";
}
}


/*-------------------------鼠标拖动---------------------*/
var od = document.getElementById("fd");
var dx, dy, mx, my, mouseD;
var odrag;
var isIE = document.all ? true : false;
document.onmouseover = function(e) {
var e = e ? e : event;
if (e.button == (document.all ? 1 : 0)) {
mouseD = true;
}
}
document.onmouseup = function() {
mouseD = false;
odrag = "";
if (isIE) {
od.releaseCapture();
od.filters.alpha.opacity = 100;
}
else {
window.releaseEvents(od.MOUSEMOVE);
od.style.opacity = 1;
}
}


//function readyMove(e){
od.mousedown = function(e) {
odrag = this;
var e = e ? e : event;
if (e.button == (document.all ? 1 : 0)) {
mx = e.clientX;
my = e.clientY;
od.style.left = od.offsetLeft + "px";
od.style.top = od.offsetTop + "px";
if (isIE) {
od.setCapture();
od.filters.alpha.opacity = 50;
}
else {
window.captureEvents(Event.MOUSEMOVE);
od.style.opacity = 0.5;
}

//alert(mx);
//alert(my);

}
}
document.onmousemove = function(e) {
var e = e ? e : event;

//alert(mrx);
//alert(e.button);
if (mouseD == true && odrag) {
var mrx = e.clientX - mx;
var mry = e.clientY - my;
od.style.left = parseInt(od.style.left) + mrx + "px";
od.style.top = parseInt(od.style.top) + mry + "px";
mx = e.clientX;
my = e.clientY;

}
}


</script>

</form>
</body>
</html>


...全文
266 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
子夜__ 2011-02-25
  • 打赏
  • 举报
回复
IE6 和FF 下都可以正常的输入

你的代码我没有改过

不知道你那是什么环境

另外我直接新建一个工程 将你的代码复制进去

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DOM_text01</title>
<style type="text/css">
body,span,div,td{font-size:12px;line-height:1.5em;color:#849BCA;}
#bodyL{
float:left;
width:84px;
margin-right:2px;
}
a.od{
width:80px;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
border: 2px solid #849BCA;
display:block;
color:#547BC9;
float:left;
text-decoration:none;
margin-top:2px;
}
a.od:link{
background:#EEF1F8;
}
a.od:visited{
background:#EEF1F8;
}
a.od:hover{
background:#EEE;
}
a.od:active{
background:#EEE;
}
#fd{
width:500px;
height:200px;
background:#EDF1F8;
border: 2px solid #849BCA;
margin-top:2px;
margin-left:2px;
float:left;
overflow:hidden;
position:absolute;
left:0px;
top:0px;
cursor:move;
float:left;
/*filter:alpha(opacity=50);*/

}
.content{
padding:10px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="bodyL">
<a href="#" class="od" onclick = "show('fd');return false;">
[打开层]
</a>
<a href="#" class="od" onclick = "closeed('fd');return false;">
[关闭层]
</a>
</div>
<div id="fd" style="display:none;filter:alpha(opacity=100);opacity:1;">
<div class="content">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


</div>
</div>

<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id) {/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function() { openx(o, 500) }, 10);
}
function openx(o, x) {/*--打开x--*/
var cx = parseInt(o.style.width);
if (cx < x) {
o.style.width = (cx + Math.ceil((x - cx) / 5)) + "px";
}
else {
clearInterval(prox);
proy = setInterval(function() { openy(o, 200) }, 10);
}
}
function openy(o, y) {/*--打开y--*/
var cy = parseInt(o.style.height);
if (cy < y) {
o.style.height = (cy + Math.ceil((y - cy) / 5)) + "px";
}
else {
clearInterval(proy);
}
}
function closeed(id) {/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
if (o.style.display == "block") {
proyc = setInterval(function() { closey(o) }, 10);
}
}
function closey(o) {/*--打开y--*/
var cy = parseInt(o.style.height);
if (cy > 0) {
o.style.height = (cy - Math.ceil(cy / 5)) + "px";
}
else {
clearInterval(proyc);
proxc = setInterval(function() { closex(o) }, 10);
}
}
function closex(o) {/*--打开x--*/
var cx = parseInt(o.style.width);
if (cx > 0) {
o.style.width = (cx - Math.ceil(cx / 5)) + "px";
}
else {
clearInterval(proxc);
o.style.display = "none";
}
}


/*-------------------------鼠标拖动---------------------*/
var od = document.getElementById("fd");
var dx, dy, mx, my, mouseD;
var odrag;
var isIE = document.all ? true : false;
document.onmouseover = function(e) {
var e = e ? e : event;
if (e.button == (document.all ? 1 : 0)) {
mouseD = true;
}
}
document.onmouseup = function() {
mouseD = false;
odrag = "";
if (isIE) {
od.releaseCapture();
od.filters.alpha.opacity = 100;
}
else {
window.releaseEvents(od.MOUSEMOVE);
od.style.opacity = 1;
}
}


//function readyMove(e){
od.mousedown = function(e) {
odrag = this;
var e = e ? e : event;
if (e.button == (document.all ? 1 : 0)) {
mx = e.clientX;
my = e.clientY;
od.style.left = od.offsetLeft + "px";
od.style.top = od.offsetTop + "px";
if (isIE) {
od.setCapture();
od.filters.alpha.opacity = 50;
}
else {
window.captureEvents(Event.MOUSEMOVE);
od.style.opacity = 0.5;
}

//alert(mx);
//alert(my);

}
}
document.onmousemove = function(e) {
var e = e ? e : event;

//alert(mrx);
//alert(e.button);
if (mouseD == true && odrag) {
var mrx = e.clientX - mx;
var mry = e.clientY - my;
od.style.left = parseInt(od.style.left) + mrx + "px";
od.style.top = parseInt(od.style.top) + mry + "px";
mx = e.clientX;
my = e.clientY;

}
}


</script>

</form>
</body>
</html>






晚安了 有问题 明天在来看。。
子夜__ 2011-02-25
  • 打赏
  • 举报
回复




能看见图不
一克代码 2011-02-25
  • 打赏
  • 举报
回复
页面调用直接

<a href="javaScript:operCent()">弹出层</a>
一克代码 2011-02-25
  • 打赏
  • 举报
回复
给你一个我用的

一个js


//*****************************************************************************
//以下代码为封装弹出层JS代码
//*****************************************************************************

var parentElement = parent.rootElement != undefined ? parent : window;
var rootElement = parentElement.rootElement != undefined ? parentElement.rootElement : parentElement;

var LayerNumber = 0;

function LcLayer(idstring) {
var Layer = new Object;
LayerNumber = LayerNumber + 1;
var oBody = document.body;
var bgDiv = null;
var oDiv = null;
var x0 = 0, y0 = 0, x1 = 0, y1 = 0;
var offx = 6, offy = 6;
var isdraging = false;

//属性定义
Layer.LayerTitle = "-";
Layer.TitleColor = "#a6c1f7";
Layer.Border = "2px solid #6c97cc";
Layer.Background = "#ffffff";
Layer.CloseColor = "#0000ff";
Layer.LayerType = 0;
Layer.LayerUrl = "about:blank";
Layer.LayerHTML = "";
Layer.Scrolling = "auto";
Layer.Padding = 6;
Layer.IsReLoad = false;
Layer.GetResult = 0;
Layer.SetResult = "";
Layer.Width = 400;
Layer.Height = 300;

//初始化层
Layer.open = function() {
var loadflag = this.IsReLoad;

bgDiv = document.createElement("div");
bgDiv.id = "WinLayer" + LayerNumber;
bgDiv.className = "layerbg";
bgDivBg = document.createElement("div");
bgDivBg.className = "layerbgbg";
bgDiv.appendChild(bgDivBg);

oDiv = document.createElement("div");
oDiv.id = idstring;
oDiv.style.backgroundColor = this.Background;
oDiv.className = "layerbody";
oDiv.style.width = this.Width;
oDiv.style.height = this.Height;

var oTitleTable = document.createElement("TABLE");
oTitleTable.style.width = "100%";
oTitleTable.style.height = "100%";
oTitleTable.border = "0";
oTitleTable.cellPadding = "0";
oTitleTable.cellSpacing = "0";
var oTitle = oTitleTable.insertRow();
oTitle.height = 30;
oTitle.style.backgroundColor = this.TitleColor;
oTitle.insertCell();
oTitle.cells(0).style.paddingLeft = '10px';
oTitle.cells(0).innerHTML = this.LayerTitle;
oTitle.cells(0).onmousedown = function() {
this.style.cursor = "move";
this.setCapture();
x0 = event.clientX;
y0 = event.clientY;
x1 = parseInt(oDiv.style.left);
y1 = parseInt(oDiv.style.top);
isdraging = true;
}
oTitle.cells(0).onmousemove = function() {
if (isdraging) {
var x = x1 + event.clientX - x0;
var y = y1 + event.clientY - y0;
var xx = document.body.clientWidth - oDiv.offsetWidth - offx;
var yy = document.body.clientHeight - oDiv.offsetHeight - offy;
if (x <= offx) x = offx;
if (y <= offy) y = offy;
if (x >= xx) x = xx;
if (y >= yy) y = yy;
oDiv.style.left = x;
oDiv.style.top = y;
}
}
oTitle.cells(0).onmouseup = function() {
this.style.cursor = "auto";
isdraging = false;
this.releaseCapture();
}
oTitle.insertCell();
oTitle.cells(1).id = idstring + '_Close';
oTitle.cells(1).style.width = 54;
oTitle.cells(1).style.textAlign = 'center';
oTitle.cells(1).style.color = this.CloseColor;
oTitle.cells(1).style.fontSize = '12px';
oTitle.cells(1).style.cursor = 'pointer';
oTitle.cells(1).innerHTML = "【关闭】";
oTitle.cells(1).onclick = function() {
//CloseLayer(idstring);
if (loadflag == true) document.location.replace(document.location.href);
var oBodyc = document.body;
var oDivc = document.getElementById(idstring);
var obgDivc = oDivc.parentElement;
if (obgDivc) obgDivc.style.display = 'none';
oBodyc.removeChild(obgDivc);
obgDivc = null;
}

var oTable = document.createElement("TABLE");
oTable.style.width = "100%";
oTable.style.height = "100%";
oTable.style.border = this.Border;
oTable.cellPadding = "0";
oTable.cellSpacing = "0";
var oTableHeader = oTable.insertRow();
oTableHeader.height = 30;
oTableHeader.insertCell();
oTableHeader.cells(0).appendChild(oTitleTable);

var oDivContentTable = document.createElement("TABLE");
oDivContentTable.style.width = "100%";
oDivContentTable.style.height = "100%";
oDivContentTable.style.border = "0";
oDivContentTable.cellPadding = "0";
oDivContentTable.cellSpacing = "0";
var oContentRow = oDivContentTable.insertRow();
oContentRow.insertCell();
oContentRow.cells(0).width = this.Padding;
var iframehtml = this.LayerHTML;
if (this.LayerType == 0) {
iframehtml = "<iframe id='" + idstring + "_Frame' name='" + idstring + "_Frame' style='width:100%;height:100%;' ";
iframehtml += "src='" + this.LayerUrl + "' marginwidth='0' marginheight='0' ";
iframehtml += "frameBorder='0' scrolling='auto'></iframe>";
}
else {
var htmlstr = "<div style='width:100%;height:100%;overflow:auto;line-height:1.3;'>";
htmlstr += iframehtml;
htmlstr += "<div>";
iframehtml = htmlstr;
}
oContentRow.insertCell();
oContentRow.cells(1).innerHTML = iframehtml;
oContentRow.insertCell();
oContentRow.cells(2).width = this.Padding;

var oTopRow = oTable.insertRow();
oTopRow.insertCell();
oTopRow.cells(0).height = this.Padding;
var oDivContent = oTable.insertRow();
oDivContent.insertCell();
oDivContent.cells(0).height = "100%";
oDivContent.cells(0).appendChild(oDivContentTable);
var oBottomRow = oTable.insertRow();
oBottomRow.insertCell();
if (this.LayerType == 2) {
oBottomRow.cells(0).height = 50;
oBottomRow.cells(0).style.textAlign = "center";
var BottomMsgBtn = document.createElement("INPUT");
BottomMsgBtn.type = "button";
BottomMsgBtn.value = " 确定 ";
BottomMsgBtn.onclick = function() {
CloseLayer(idstring);
}
oBottomRow.cells(0).appendChild(BottomMsgBtn);
}
else {
oBottomRow.cells(0).height = this.Padding;
}

oDiv.appendChild(oTable);
bgDiv.appendChild(oDiv);
oBody.appendChild(bgDiv);

if (bgDiv) bgDiv.style.display = 'block';
if (oDiv) oDiv.style.display = 'block';
}

return Layer;
}

//关闭弹出层
function CloseLayer(idstring) {
//var oBody = document.body;
//var oDiv = document.getElementById(idstring);
//var obgDiv = oDiv.parentElement;
//if (obgDiv) obgDiv.style.display = 'none';
//oBody.removeChild(obgDiv);
//obgDiv = null;
var oClose = document.getElementById(idstring + "_Close");
if(oClose) oClose.click();
}



页面调用直接


<script src="../../Inc/Layer.js" type="text/javascript"></script>
<script type="text/javascript">
GroupsSelect("hdnGroupsCode");

function operCent(needId, needType, vendCode,flag,pactid) {
var Layer_Cent = new rootElement.LcLayer('Layer_Cent');//新建个层
Layer_Cent.LayerUrl = "Cent.aspx?needType=" + needType + "&needId=" + needId + "&vendCode=" + vendCode + "&flag=" + flag + "&pactid=" + pactid;//弹出层里面的页面路径
Layer_Cent.IsReLoad = true;
Layer_Cent.Width = 700;//设置层的宽
Layer_Cent.Height = 470;
Layer_Cent.open();//打开
}
</script>
huangwenquan123 2011-02-25
  • 打赏
  • 举报
回复

<!--重新改了下,刚才不兼容ff,现在ie6 7 8 ff opera都测试可以-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DOM_text01</title>
<style type="text/css">
body, span, div, td
{
font-size: 12px;
line-height: 1.5em;
color: #849BCA;
}
#bodyL
{
float: left;
width: 84px;
margin-right: 2px;
}
a.od
{
width: 80px;
height: 25px;
line-height: 25px;
text-align: center;
font-weight: bold;
border: 2px solid #849BCA;
display: block;
color: #547BC9;
float: left;
text-decoration: none;
margin-top: 2px;
}
a.od:link
{
background: #EEF1F8;
}
a.od:visited
{
background: #EEF1F8;
}
a.od:hover
{
background: #EEE;
}
a.od:active
{
background: #EEE;
}
#fd
{
width: 500px;
height: 200px;
background: #EDF1F8;
border: 2px solid #849BCA;
margin-top: 2px;
margin-left: 2px;
float: left;
overflow: hidden;
position: absolute;
left: 0px;
top: 0px;
cursor: move;
float: left; /*filter:alpha(opacity=50);*/
}
.content
{
padding: 10px;
}
</style>
</head>
<body>
<form runat="server">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<div id="bodyL">
<a href="#" class="od" onclick="show('fd');return false;">[打开层] </a><a href="#" class="od"
onclick="closeed('fd');return false;">[关闭层] </a>
</div>
<div id="fd" style="display: none; filter: alpha(opacity=100); opacity: 1;">
<div id="head" style="height: 30px; background: red; width: 100%;">
</div>
<div class="content" style="z-index: 9999; border: 1px solid #ccc;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Text1" type="text" />
</div>
</div>
</form>

<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id){/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function(){openx(o,500)},10);
}
function openx(o,x){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx < x)
{
o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
}
else
{
clearInterval(prox);
proy = setInterval(function(){openy(o,200)},10);
}
}
function openy(o,y){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy < y)
{
o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
}
else
{
clearInterval(proy);
}
}
function closeed(id){/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
if(o.style.display == "block")
{
proyc = setInterval(function(){closey(o)},10);
}
}
function closey(o){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy > 0)
{
o.style.height = (cy - Math.ceil(cy/5)) +"px";
}
else
{
clearInterval(proyc);
proxc = setInterval(function(){closex(o)},10);
}
}
function closex(o){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx > 0)
{
o.style.width = (cx - Math.ceil(cx/5)) +"px";
}
else
{
clearInterval(proxc);
o.style.display = "none";
}
}


/*-------------------------鼠标拖动---------------------*/
var od = document.getElementById("head");
var dx,dy,mx,my,mouseD;
var odrag;
var isIE = document.all ? true : false;
document.onmousedown = function(e){
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mouseD = true;
}
}
document.onmouseup = function(){
mouseD = false;
odrag = "";
if(isIE)
{
od.parentNode.releaseCapture();
od.parentNode.filters.alpha.opacity = 100;
}
else
{
window.releaseEvents(od.MOUSEMOVE);
od.parentNode.style.opacity = 1;
}
}


//function readyMove(e){
od.onmousedown = function(e){
odrag = this;
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mx = e.clientX;
my = e.clientY;
od.parentNode.style.left = od.parentNode.offsetLeft + "px";
od.parentNode.style.top = od.parentNode.offsetTop + "px";
if(isIE)
{
od.parentNode.setCapture();
od.parentNode.filters.alpha.opacity = 50;
}
else
{
window.captureEvents(Event.MOUSEMOVE);
od.parentNode.style.opacity = 0.5;
}

//alert(mx);
//alert(my);

}
}
document.onmousemove = function(e){
var e = e ? e : event;

//alert(mrx);
//alert(e.button);
if(mouseD==true && odrag)
{
var mrx = e.clientX - mx;
var mry = e.clientY - my;
od.parentNode.style.left = parseInt(od.parentNode.style.left) +mrx + "px";
od.parentNode.style.top = parseInt(od.parentNode.style.top) + mry + "px";
mx = e.clientX;
my = e.clientY;
}
}
</script>

</body>
</html>
huangwenquan123 2011-02-25
  • 打赏
  • 举报
回复

<!--帮你改了下,加了个头部,现在是按住头部才可以拖动,因为你写的按住层的话会缩定,这样就不能输入!-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DOM_text01</title>
<style type="text/css">
body, span, div, td
{
font-size: 12px;
line-height: 1.5em;
color: #849BCA;
}
#bodyL
{
float: left;
width: 84px;
margin-right: 2px;
}
a.od
{
width: 80px;
height: 25px;
line-height: 25px;
text-align: center;
font-weight: bold;
border: 2px solid #849BCA;
display: block;
color: #547BC9;
float: left;
text-decoration: none;
margin-top: 2px;
}
a.od:link
{
background: #EEF1F8;
}
a.od:visited
{
background: #EEF1F8;
}
a.od:hover
{
background: #EEE;
}
a.od:active
{
background: #EEE;
}
#fd
{
width: 500px;
height: 200px;
background: #EDF1F8;
border: 2px solid #849BCA;
margin-top: 2px;
margin-left: 2px;
float: left;
overflow: hidden;
position: absolute;
left: 0px;
top: 0px;
cursor: move;
float: left; /*filter:alpha(opacity=50);*/
}
.content
{
padding: 10px;
}
</style>
</head>
<body>
<form runat="server">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<div id="bodyL">
<a href="#" class="od" onclick="show('fd');return false;">[打开层] </a><a href="#" class="od"
onclick="closeed('fd');return false;">[关闭层] </a>
</div>
<div id="fd" style="display: none; filter: alpha(opacity=100); opacity: 1;">
<div id="head" style="height: 30px; background: red; width: 100%;">
</div>
<div class="content" style="z-index: 9999; border: 1px solid #ccc;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Text1" type="text" />
</div>
</div>
</form>

<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id){/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function(){openx(o,500)},10);
}
function openx(o,x){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx < x)
{
o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
}
else
{
clearInterval(prox);
proy = setInterval(function(){openy(o,200)},10);
}
}
function openy(o,y){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy < y)
{
o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
}
else
{
clearInterval(proy);
}
}
function closeed(id){/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
if(o.style.display == "block")
{
proyc = setInterval(function(){closey(o)},10);
}
}
function closey(o){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy > 0)
{
o.style.height = (cy - Math.ceil(cy/5)) +"px";
}
else
{
clearInterval(proyc);
proxc = setInterval(function(){closex(o)},10);
}
}
function closex(o){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx > 0)
{
o.style.width = (cx - Math.ceil(cx/5)) +"px";
}
else
{
clearInterval(proxc);
o.style.display = "none";
}
}


/*-------------------------鼠标拖动---------------------*/
var od = document.getElementById("head");
var dx,dy,mx,my,mouseD;
var odrag;
var isIE = document.all ? true : false;
document.onmousedown = function(e){
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mouseD = true;
}
}
document.onmouseup = function(){
mouseD = false;
odrag = "";
if(isIE)
{
od.parentElement.releaseCapture();
od.parentElement.filters.alpha.opacity = 100;
}
else
{
window.releaseEvents(od.MOUSEMOVE);
od.parentElement.style.opacity = 1;
}
}


//function readyMove(e){
od.onmousedown = function(e){
odrag = this;
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mx = e.clientX;
my = e.clientY;
od.parentElement.style.left = od.parentElement.offsetLeft + "px";
od.parentElement.style.top = od.parentElement.offsetTop + "px";
if(isIE)
{
od.parentElement.setCapture();
od.parentElement.filters.alpha.opacity = 50;
}
else
{
window.captureEvents(Event.MOUSEMOVE);
od.parentElement.style.opacity = 0.5;
}

//alert(mx);
//alert(my);

}
}
document.onmousemove = function(e){
var e = e ? e : event;

//alert(mrx);
//alert(e.button);
if(mouseD==true && odrag)
{
var mrx = e.clientX - mx;
var mry = e.clientY - my;
od.parentElement.style.left = parseInt(od.parentElement.style.left) +mrx + "px";
od.parentElement.style.top = parseInt(od.parentElement.style.top) + mry + "px";
mx = e.clientX;
my = e.clientY;
}
}
</script>

</body>
</html>
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
我要的是既能输入,又能移动的。
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DOM_text01</title>
<style type="text/css">
body,span,div,td{font-size:12px;line-height:1.5em;color:#849BCA;}
#bodyL{
float:left;
width:84px;
margin-right:2px;
}
a.od{
width:80px;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
border: 2px solid #849BCA;
display:block;
color:#547BC9;
float:left;
text-decoration:none;
margin-top:2px;
}
a.od:link{
background:#EEF1F8;
}
a.od:visited{
background:#EEF1F8;
}
a.od:hover{
background:#EEE;
}
a.od:active{
background:#EEE;
}
#fd{
width:500px;
height:200px;
background:#EDF1F8;
border: 2px solid #849BCA;
margin-top:2px;
margin-left:2px;
float:left;
overflow:hidden;
position:absolute;
left:0px;
top:0px;
cursor:move;
float:left;
/*filter:alpha(opacity=50);*/

}
.content{
padding:10px;
}
</style>
</head>
<body>
<div id="bodyL">
<a href="#" class="od" onclick = "show('fd');return false;">
[打开层]
</a>
<a href="#" class="od" onclick = "closeed('fd');return false;">
[关闭层]
</a>
</div>
<div id="fd" style="display:none;filter:alpha(opacity=100);opacity:1;">
<div class="content">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


</div>
</div>

<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id){/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function(){openx(o,500)},10);
}
function openx(o,x){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx < x)
{
o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
}
else
{
clearInterval(prox);
proy = setInterval(function(){openy(o,200)},10);
}
}
function openy(o,y){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy < y)
{
o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
}
else
{
clearInterval(proy);
}
}
function closeed(id){/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
if(o.style.display == "block")
{
proyc = setInterval(function(){closey(o)},10);
}
}
function closey(o){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy > 0)
{
o.style.height = (cy - Math.ceil(cy/5)) +"px";
}
else
{
clearInterval(proyc);
proxc = setInterval(function(){closex(o)},10);
}
}
function closex(o){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx > 0)
{
o.style.width = (cx - Math.ceil(cx/5)) +"px";
}
else
{
clearInterval(proxc);
o.style.display = "none";
}
}


/*-------------------------鼠标拖动---------------------*/
var od = document.getElementById("fd");
var dx,dy,mx,my,mouseD;
var odrag;
var isIE = document.all ? true : false;
document.onmousedown = function(e){
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mouseD = true;
}
}
document.onmouseup = function(){
mouseD = false;
odrag = "";
if(isIE)
{
od.releaseCapture();
od.filters.alpha.opacity = 100;
}
else
{
window.releaseEvents(od.MOUSEMOVE);
od.style.opacity = 1;
}
}


//function readyMove(e){
od.onmousedown = function(e){
odrag = this;
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0))
{
mx = e.clientX;
my = e.clientY;
od.style.left = od.offsetLeft + "px";
od.style.top = od.offsetTop + "px";
if(isIE)
{
od.setCapture();
od.filters.alpha.opacity = 50;
}
else
{
window.captureEvents(Event.MOUSEMOVE);
od.style.opacity = 0.5;
}

//alert(mx);
//alert(my);

}
}
document.onmousemove = function(e){
var e = e ? e : event;

//alert(mrx);
//alert(e.button);
if(mouseD==true && odrag)
{
var mrx = e.clientX - mx;
var mry = e.clientY - my;
od.style.left = parseInt(od.style.left) +mrx + "px";
od.style.top = parseInt(od.style.top) + mry + "px";
mx = e.clientX;
my = e.clientY;

}
}


</script>
</body>
</html>


这个可以移动,但是又不能输入了。
wyq29 2011-02-25
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 gefangliang 的回复:]
请问子夜,我弹出层可以输入时不能移动了,问题纠结在这里啊,怪我没有说清楚,感谢你!。

引用 3 楼 wxr0323 的回复:
IE6 和FF 下都可以正常的输入

你的代码我没有改过

不知道你那是什么环境

另外我直接新建一个工程 将你的代码复制进去


HTML code
<html xmlns="http://www.w3.org/1999/xhtml">
<h……
[/Quote]

你这个弹出层 本来就不能移动啊 输入不输入都不能移动 和输入不输入没关系啊
难道你不输入时候可以移动? 输入时不能移动??

心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
不太熟悉,能否发个例子过来,感谢![Quote=引用 5 楼 fengyarongaa 的回复:]
我说你 给一个jquery 遮罩
然后 注册文本框的属性 输入为false
[/Quote]
ycproc 2011-02-25
  • 打赏
  • 举报
回复
我说你 给一个jquery 遮罩
然后 注册文本框的属性 输入为false
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
请问子夜,我弹出层可以输入时不能移动了,问题纠结在这里啊,怪我没有说清楚,感谢你!。[Quote=引用 3 楼 wxr0323 的回复:]
IE6 和FF 下都可以正常的输入

你的代码我没有改过

不知道你那是什么环境

另外我直接新建一个工程 将你的代码复制进去


HTML code
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=……
[/Quote]
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
你去这个帖子,我把分给你,都是一样的问题。[Quote=引用 20 楼 adsdassadfasdfasdf 的回复:]
引用 19 楼 gefangliang 的回复:
另外特别感谢:wxr0323;ztxneter,adsdassadfasdfasdf,huangwenquan123,wuyq11,(排名不分先后!)差不多解决了,等完全搞定发源码出来。


我都绝对可以解决你的问题!

我都是用这!
[/Quote]
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
非常感谢你,你的例子給力啊![Quote=引用 20 楼 adsdassadfasdfasdf 的回复:]
引用 19 楼 gefangliang 的回复:
另外特别感谢:wxr0323;ztxneter,adsdassadfasdfasdf,huangwenquan123,wuyq11,(排名不分先后!)差不多解决了,等完全搞定发源码出来。


我都绝对可以解决你的问题!

我都是用这!
[/Quote]
一克代码 2011-02-25
  • 打赏
  • 举报
回复
[Quote=引用 19 楼 gefangliang 的回复:]
另外特别感谢:wxr0323;ztxneter,adsdassadfasdfasdf,huangwenquan123,wuyq11,(排名不分先后!)差不多解决了,等完全搞定发源码出来。
[/Quote]

我都绝对可以解决你的问题!

我都是用这!
心灵彩虹 2011-02-25
  • 打赏
  • 举报
回复
另外特别感谢:wxr0323;ztxneter,adsdassadfasdfasdf,huangwenquan123,wuyq11,(排名不分先后!)差不多解决了,等完全搞定发源码出来。
truecoffeefox 2011-02-25
  • 打赏
  • 举报
回复
可以输入啊,没问题
ztxneter 2011-02-25
  • 打赏
  • 举报
回复
<input type="text"  onclick="this.focus();"/> 这样就可以了
wuyq11 2011-02-25
  • 打赏
  • 举报
回复
OnClientClick=<%# "OpenWindow('"+Eval("Id")+"', 700,250);return false;" %>

<SCRIPT src="js/ui.mouse.js" type=text/javascript></SCRIPT>
<SCRIPT src="js/ui.draggable.js" type=text/javascript></SCRIPT>
<SCRIPT src="js/jquery.jwindow.js" type=text/javascript></SCRIPT>
<script>
function OpenWindow(id,width,height) {
var p = document.getElementById("<%=hf_Id.ClientID %>").value;
var url = "a.aspx?Id=" + id + "&pId=" + p;
SetTitle(url);
OpenJWindow('#openwin', url, width, height, EditClosed);
}
function SetTitle(url)
{
var obj = document.getElementById("winTitle");

if(url.lastIndexOf("Id") >0){
obj.innerHTML ="编辑";
return;
}
obj.innerHTML ="新增";
}
function EditClosed(result) {

if (result == "0") return;
return false;
}

弹出jquery 遮罩

62,072

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧