在层里放一个新的form,提交这个form就可以了
解决方案 »
- js能控制iframe里面的内容吗?
- [请教各位]js页面打印问题
- 求一个像Windows资源管理器这样的多级菜单
- 如何清空Form内输入框、下拉框的内容或还原为默认值?
- 请 net_lover(孟子E章) 进来一下。
- 我在写判断表单的日期,用JAVASCRIPT来检测的。
- 高手救命:input对象的属性type能改变值吗?
- 如何得到屏摹的宽度,还有就是图片距离屏摹上部,左面的高与宽?!
- 急急急急急急急;;;js+html+css来实现使用键盘上的左右上下键来选中页面上的图片
- js块级作用域,问题
- 100分继续请教:如何把list里的内容通过excel的格式导出
- firefox解析xml文档的问题,大家帮忙啊!
<HTML><HEAD><TITLE>index</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT src="css/layout.js" type=text/javascript></SCRIPT>
<DIV><A
href="javascript:open_lw('login_win',350,190,'','')">登 陆</A></DIV>
</BODY>
</HTML>
文件layout.js//新层的定义
var LOGIN_WINDDOW = "<div style='height:28px; z-index:999; border-bottom:1px #c0d4db solid; background:#e7f0f7;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#f7fcff,endColorStr=#e7f0f9)'></div><div style='line-height:30px;float:left; margin-top:-28px; padding-left:12px; font-family:simsun; font-size:12px; color:#0198cf'>用户登陆</div><div onclick='close_lw(login_win.id)' style='float:right; cursor:pointer;margin:-23px 3px 0px 0px ; padding: 1px 0px 0px 1px; height:8px; width:46px; color:#0198cf; font:12px;'><div style='float:right;width:16px;height:16px;background-image:url(images/leftall.gif) ;background-position: -14px -0px;'></div><b style='display:block;margin-top:4px;'>关闭</B></div><div id='login_error_div_back' style='width:100%;font-size:12px; height:12px;color:#000'><center id='login_error_div'></center></div><div style='margin:20px auto 10px 60px;width:210px; font-size:14px;color:#0198cf'>用户名:<input id='user_name' style='border:#0198cf 1px solid; width:120px; height:16px;' type='text' /></div><div style='margin:0px auto 10px 60px;;width:210px; font-size:14px; color:#0198cf'>密 码:<input id='pass_word' style='border:#0198cf 1px solid; width:120px; height:16px;' type='password' /></div><div style='margin:0px 0px 0px 60px;width:210px; text-align:right;'><input id='login_button' onclick='layout_login()' style='border:#009ace 1px solid;background:#0198cf; width:100px; height:22px; margin-right:23px; color:#FFF; TabIndex='0' padding-top:2px;' type='submit' value='登 录' /></div>";
var objX = 0;
var objY = 0;
function set_div_style(obj,id,top,left,width,height,position,border,cursor,background,filter)
{
var obj = obj;
obj.style.filter=filter?"Alpha(Opacity="+filter+")":0;
obj.id = id?id:null;
obj.style.top = top?top:0;
obj.style.left = left?left:0;
obj.style.width = width?width:0;
obj.style.height = height?height:0;
obj.style.position = position?position:"static";
obj.style.border = border?border:"1px #000 solid";
obj.style.cursor = cursor?cursor:"default";
obj.style.background = background?background:"";
return obj
}
/////////////////////////////////////////////////////////////////////////////////
//管理层的拖动
function drag(obj)
{
if(objX!=0&&objY!=0)
{
if(event==null)
{}
else if(event.button == 1)
{
obj.style.left = event.clientX-objX;
obj.style.top = event.clientY-objY;
}
}
}function drag_mouse_down(obj)
{
var obj_left = obj.style.left;
var obj_top = obj.style.top;
var obj_left = obj_left.replace(/p|x/g,"");
var obj_top = obj_top.replace(/p|x/g,"");
var clientX = String(event.clientX).replace(/p|x/g,"");
var clientY = String(event.clientY).replace(/p|x/g,"");
objX = clientX - obj_left;
objY = clientY - obj_top;
}////////////////////////////////////////////////////////////////////////
function open_lw(id,width,height)
{
if(!$(id))
{
var lw = document.createElement("div");
var lw2 = document.createElement("div");
var ifr = document.createElement("iframe");
var lw_id = id;
var lw2_id = id + "_lw2";
var ifr_id = id + "_ifr";
var lw_left = window.screen.width/2-width/2;
var lw2_left = 0;
var ifr_left = 0;
var lw = set_div_style(lw,lw_id,200,lw_left,width,height,"absolute","0px solid #c0d4db","default","#fff");
var lw2 = set_div_style(lw2,lw2_id,0,lw2_left,width,height,"absolute","1px solid #c0d4db","default","#fff");
var ifr = set_div_style(ifr,ifr_id,0,ifr_left,width,height,"absolute","0px solid #c0d4db","default","#fff");
document.body.appendChild(lw);
lw.appendChild(ifr);
lw.appendChild(lw2);
lw2.innerHTML += LOGIN_WINDDOW;
var drag_div = $('login_win_lw2').firstChild;
document.body.onmousemove = function (){drag(lw)};
document.body.onmouseup = function(){objX = 0;objY=0}
drag_div.onmousedown = function (){drag_mouse_down(lw)};
$("user_name").focus();
}
}function on_close(){
{
top.fresh_tasklist(0);
if(window.top.$("set_tools_id")!=null)
{
var lw = window.top.$("set_tools_id");
var lw2 = window.top.$("set_tools_id2");
top.document.getElementById('set_tools').src = '';
window.top.document.body.removeChild(lw);
window.top.document.body.removeChild(lw2);
}
if(window.top.$("set_row_id")!=null)
{
var lw = window.top.$("set_row_id");
var lw2 = window.top.$("set_row_id2");
top.document.getElementById('set_row').src = '';
window.top.document.body.removeChild(lw);
window.top.document.body.removeChild(lw2);
}
}
}function close_lw(id)
{
if($(id))
{
var lw = $(id);
document.body.removeChild(lw);
}
}function layout_login()
{
var usnm = $("user_name").value;
var uspwd = $("pass_word").value;
if(usnm=="")
{
alert("请输入用户名");
$("user_name").focus();
}
else if(uspwd=="")
{
alert("请输入密码");
$("pass_word").focus();
}
else
{
location.href="1.asp"
}
}function $(id)
{
var obj = document.getElementById(id);
if (obj != null)
return obj;
return null;
}
var LOGIN_WINDDOW = "<form name=frm action='login.asp'><div ...>input id='login_button' onclick='layout_login()' style='border:#009ace 1px solid;background:#0198cf; width:100px; height:22px; margin-right:23px; color:#FFF; TabIndex='0' padding-top:2px;' type='submit' value='登 录' /></div></form>";2.如果“登录”按钮的type=submit。
在没通过验证,不想提交时layout_login返回false,,并且:onclick="return layout_login();"3.你现在没提交的原因是,该提交时,你把它指向了1.asp
function layout_login()
{
...
else
{
location.href="1.asp"
}
}