`
kingmxj
  • 浏览: 178054 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

模式对话框

    博客分类:
  • html
阅读更多
1.弹出对话框的页面:
<%@page contentType="text/html;charset=GBK"%>
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>

  <body>
    This is a ModelDialogBox Test!<br/>
   <form action="">
   <input type="text" name="ss1" value=""/>
   <input type="text" name="ss" value=""/>
   </form>
    <button onclick="t()">TEST</button>
    <button onclick="t1()">TEST1</button>
  </body>
  <script type="text/javascript">
  function t()
  {
 
  var arr = window.showModalDialog('2.jsp','', "dialogHeight:800px; dialogWidth:500px; dialogLeft:(screen.availWidth/2-100); dialogTop:(screen.availHeight/2-50);center: yes;help:no;resizable:no;status:yes");
  document.forms[0].ss.value = arr[0];
  }
  function t1()
  {
 
  var arr = window.showModalDialog('3.jsp','', "dialogHeight:800px; dialogWidth:500px; dialogLeft:(screen.availWidth/2-100); dialogTop:(screen.availHeight/2-50);center: yes;help:no;resizable:no;status:yes");
  alert(arr.length);
  var v = "";
  var v1 = "";
  for(var i=0;i<arr.length-1;i++)//arr.length-1
  {
  if(i%2!=0)
  {
  v = v+arr[i].toString()+" ";//Name
  }else{
  v1 = v1+arr[i].toString()+",";//ID
  }
 
  }
  var i = arr[arr.length-1];
  alert(i);
  document.forms[0].ss.value = v;
  document.forms[0].ss1.value = v1;
  }
  </script>

2.用于访问后台的页面:
<%@page contentType="text/html;charset=GBK"%>

<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragrma","no-cache");
response.setDateHeader("Expires",0);
%>
<body>
<iframe src="<%=request.getContextPath() %>/tree!query.action"  frameborder="1" height="100%" name="kkk" scrolling="auto" width="100%"></iframe>
</body>


<%@page contentType="text/html;charset=GBK"%>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragrma","no-cache");
response.setDateHeader("Expires",0);
%>
<body>
<iframe src="<%=request.getContextPath() %>/tree!test.action"  frameborder="1" height="100%" name="kkk" scrolling="auto" width="100%"></iframe>
</body>

3.模式对话框:

<%@ page language="java" contentType="text/html;charset=GBK"%>
<%@ taglib prefix="ww" uri="webwork"%>
<form>
<table>
<ww:iterator value="list" status="status">
<tr><td><INPUT TYPE="checkbox" NAME="aa" value="<ww:property value="privilege_id"/>,<ww:property value="name"/>"></td>
<td><ww:property value="name"/></td>
</tr>
</ww:iterator>
</table>
</form>

<A HREF="javascript:save()">保存</A>
<SCRIPT LANGUAGE="JavaScript">
<!--
function save() {
var tpurl=document.forms[0].aa;
var m ;
var returnArray= new Array();
//alert(tpurl.length);
for (var i=0;i<tpurl.length;i++)
{
if(tpurl[i].checked==true)
{
m=tpurl[i].value;
var ar = new Array();
ar = m.split(",");
returnArray.push(ar[0]);
returnArray.push(ar[1]);
}
}
var i = 1;
returnArray.push(i);
if(m=="")
{
alert("请选择人员!");
}else{
//var returnArray= new Array();
//returnArray = m.split(",");
alert(returnArray.length);
window.returnValue = returnArray;
window.close();
}
}

</SCRIPT>



<%@ page language="java" contentType="text/html;charset=GBK"%>
<%@ taglib prefix="ww" uri="webwork"%>
<HTML><HEAD>
<link href="<%= request.getContextPath() %>/css/dtree.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=request.getContextPath()%>/js/dtree.js"></script>
</HEAD>

<BODY bgColor=#DDF0FB leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<table width="90%" border="0" cellspacing="1" cellpadding="2" align="center" >
<tr>
<div class="dtree">
<script type="text/javascript">

d = new dTree('d');



<ww:iterator value="list" status="status">
<ww:if test="parent_id == null">
d.add('<ww:property value="privilege_id"/>',-1,'<ww:property value="name"/>');
</ww:if>
<ww:else>
<ww:if test="islink == \"1\"">
d.add('<ww:property value="privilege_id"/>','<ww:property value="parent_id"/>','<ww:property value="name"/>','<ww:property value="url"/>','<ww:property value="url"/>','right');
</ww:if>
<ww:else>
d.add('<ww:property value="privilege_id"/>','<ww:property value="parent_id"/>','<ww:property value="name"/>');

</ww:else>
</ww:else>

</ww:iterator>


document.write(d);

</script>
</div>
</tr>
</table>

<FORM name ="" METHOD=POST ACTION="">
<INPUT TYPE="radio" NAME="aa" value="成功,2,3">
<INPUT TYPE="radio" NAME="aa" value="失败,4,6">
</FORM>

<button onclick="guanBi()">close</button>
 
</BODY>
<script type="text/javascript">
function guanBi()
{
var tpurl=document.forms[0].aa;

//alert(tpurl.length);

for (var i=0;i<tpurl.length;i++)
{
if(tpurl[i].checked==true)
{
var m=tpurl[i].value;
}
}
alert(m);
if(m=="" || m==null)
{
alert("请选择人员!");
}else{
var returnArray= new Array();
returnArray = m.split(",");
window.returnValue = returnArray;
window.close();
}
}
</script>
</HTML>
     

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics