dialog表单填写的常用效果功能实现

在开发中经常遇到表单填写时,需要select选择数据,但是当数据较庞大时可以采用下面的效果

【eg.国家参数选择】

效果图:   【鼠标单击输入框或者图片,后台查询弹出国家参数列表,选择后单击选择,数据自动填写在文本框内】        

       

代码:

原页面:
<script language="javascript" src="http://www.aspbc.com/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
   function openDialogDIV(url,title,width,height){
                if(width == null)
                    width = $(window).width() * 0.95;
                if(height == null)
                    height = $(window).height() * 0.9;
                $("body").append('<div id="openDialogDIV"></div>');     
                var dialog=$("#openDialogDIV");     
                var title = title;
                dialog.html('<iframe id="grant_iframe0" src="'+url+'" frameborder="0" style="height:100%; width:100%; marginwidth:0; marginheight:0; scrolling:no;"></iframe>');
                dialog.dialog({
                    modal: true,
                    title: title,
                    width:width,
                    height:height
                });   
            }

    //原产国代码
        function guo(){
            var url= '----------------------------路径-----------------------------------------';
            openDialogDIV(url,'原产国',600,360);
        }

</script>
 <body>
<table >
   <tr >
      <td class="dataTable_addLeftText">原产国:</td>
    <td>
       <input type="text" name="CountryName" id="countryName" οnclick="guo()" readonly="readonly"/>
        <img οnclick="guo()" src="<c:url value="/images/jckj/add.png"/>" width="16" height="16" border="0" />

       <%--隐藏域存放的为国家编码--%>

       <input type="hidden" name="jyjyJackDecBdBody.originCountryCode" value="" id="countryCode" />
    </td>
    </tr>
</table>
  </body>

弹出框页面中的JavaScript:

<script language="javascript" src="http://www.aspbc.com/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
  $(function(){
            $('.dataTable_listtitle2').click(function(){
                //原产国
              //  if(){
                    window.parent.$('#countryCode').val($(this).find('td:eq(0)').html());
                    window.parent.$('#countryName').val($(this).find('td:eq(1)').html());
              //  }
                window.parent.$('#openDialogDIV').dialog('close');
            });
        });

</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郝南过

感谢大佬打赏,送你一个么么哒

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值