首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JavaScript实现弹出查询窗口,该怎么解决

2012-02-04 
JavaScript实现弹出查询窗口有一个查询按钮,当我单击这个查询按钮,弹出一个查询的窗口,这个窗口中有很多的

JavaScript实现弹出查询窗口
有一个查询按钮,当我单击这个查询按钮,弹出一个查询的窗口,这个窗口中有很多的查询字段(例如:姓名,地址,身份证),在这个窗口中有一个确定按钮,按下这个确定按钮,这个查询窗口消失,同时这个页面的列表中显示出查询的内容,请问大家这个查询窗口怎样用JavaScript实现,谢谢各位高手,小弟等着急用,谢谢了!

[解决办法]
请参考这个,这是我们系统上的一个代码
<!-- Div Start-->
<DIV id= "TipDiv " style= "DISPLAY: none; POSITION: absolute; TOP: 1150px ">
<TABLE cellSpacing= "0 " cellPadding= "0 " width= "90% " border= "0 ">
<TR onmouseup= "cleardrag() " onmousedown= "drags(TipDiv) ">
<TD width= "2 "> <IMG src= "../XPimages/N_title1.gif "> </TD>
<td background= "../XPimages/n_title.gif ">
<table cellSpacing= "0 " cellPadding= "0 " width= "100% " border= "0 ">
<tr>
<td align= "left "> <IMG src= "../XPimages/system_icon.gif "> <b> <font color= "#ffffff "> <span id= "TipSpan "> 修改资料: </span> </font> </b> </td>
<td align= "right "> <A onmouseover= "document[ 'CloseImage '].src = '../XPimages/close_over.gif '; " onmouseout= "document[ 'CloseImage '].src = '../XPimages/close.gif '; "
href= "javascript:ShowTip(1); "> <IMG src= "../XPimages/close.gif " align= "right " border= "0 " name= "CloseImage ">
</A>
</td>
</tr>
</table>
</td>
<td width= "2 "> <IMG src= "../XPimages/N_title2.gif "> </td>
</TR>
<tr>
<td width= "2 " background= "../XPimages/N_center1.gif "> </td>
<td>
<table cellSpacing= "0 " borderColorDark= "#ffffff " cellPadding= "0 " width= "100% " borderColorLight= "#000000 "
border= "1 " frame= "border ">
<TBODY>
<tr class= "trContent ">
<td style= "DISPLAY: none " noWrap> &nbsp; </td>
<td style= "HEIGHT: 16px " noWrap> 凭证日期 </td>
</tr>
<tr class= "trContent ">
<td style= "DISPLAY: none "> <input name= "Ops " id= "Ops " type= "hidden " value= "insert " /> </td>
<td> <span id= "LC_Item " style= "width:80px; "> </span> </td>
<td> <input name= "TN_QkAmt " type= "text " id= "TN_QkAmt " style= "width:80px; " /> </td>
<td> <select name= "DAccNo " id= "DAccNo " class= "input1 " style= "width:124px; ">
<option value= " "> ---请选择--- </option>
<option value= "721030 "> 醫療/壽險 </option>

</select> </td>
<td> <input name= "TC_InvoceNo " type= "text " id= "TC_InvoceNo " style= "width:80px; " /> </td>
<td> <input name= "PopDate3:Text1 " type= "text " value= "2007/05/02 " maxlength= "10 " id= "PopDate3_Text1 " style= "border-style:Groove;width:88px; " />


<input name= "PopDate3:Button1 " id= "PopDate3_Button1 " type= "button " value= "> " onclick= "calendar(eval( 'this.form.PopDate3_Text1 ')) " />
</td>
</tr>
<tr class= "trContent ">
<td noWrap colSpan= "4 "> 请款事由 </td>
<td> </td>
<tr class= "trContent ">
<td colSpan= "4 "> <input name= "TC_Sake " type= "text " id= "TC_Sake " style= "width:400px; " /> </td>
<td> <input type= "submit " name= "BSave " value= "保存 " id= "BSave " /> </td>
</tr>
</TBODY>
</table>
</td>
<td width= "2 " background= "../XPimages/N_center1.gif "> </td>
</tr>
<tr height= "4 ">
<td background= "../XPimages/N_bottom.gif " colSpan= "3 "> </td>
</tr>
</TABLE>
</DIV>
<!-- Div End-->
[解决办法]
用window.showModalDialog方法弹出查询的页面
记住在查询的页面的 <head> </head> 里加入 <base target= "_self ">


window.showModalDialog
使用方法:
vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])

参数说明:
sURL--
必选参数,类型:字符串。用来指定对话框要显示的文档的URL。
vArguments--
可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。
sFeatures--
可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号“;”隔开。
1.dialogHeight :对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
2.dialogWidth: 对话框宽度。
3.dialogLeft: 离屏幕左的距离。
4.dialogTop: 离屏幕上的距离。
5.center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
6.help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
7.resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
8.status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
9.scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
下面几个属性是用在HTA中的,在一般的网页中一般不使用。
10.dialogHide:{ yes | no | 1 | 0 | on | off }:在打印或者打印预览时对话框是否隐藏。默认为no。
11.edge:{ sunken | raised }:指明对话框的边框样式。默认为raised。
12.unadorned:{ yes | no | 1 | 0 | on | off }:默认为no。


示例
主调页面:
str =window.showModalDialog( "modal.htm ",, "dialogWidth=200px;dialogHeight=100px ");

被调页面:
<body onunload= "window.returnValue= 'ReturnString ' ">

热点排行
Bad Request.