jquery模式窗口父页面操作如此简单

下图为父窗口,点击图片事件,打开模式窗口,传入当前行ID

1 $("#datadiv img").click(function(e) {
2         var id = $(this).parent().parent().attr("id").replace("tr","");
3         window.showModalDialog(_app_url+"Schedule/problem/problem_history.asp?id="+id+"&p="+Math.random(),window,"status=no;dialogHeight=350px;dialogWidth=510px;help=no;resizable=no;scroll=no");
4     });
View Code

 

 

下图为打开后模式窗口的增加按钮事件

 1 $("#bon_add").click(function(e) {
 2        var html = $("textarea").val();
 3        if(html!=""){
 4            html=html.replace(/&/g,"&");
 5            html=html.replace(/</g,"&lt;");
 6            html=html.replace(/>/g,"&gt;");
 7            html=html.replace(/\n/g,"<br>");
 8            var topval=html;//当前进度滞后原因分析
 9            
10            //debugger
11            var date = new Date();
12            var user="<%=session("username")%>";
13            var datestr = "日期:"+date.getYear().toString().substring(2,4)+"."+r((date.getMonth()+1))+"."+r(date.getDate());
14            html=datestr+"<br>用户:"+user+"<br>"+html+"<br><br>";
15            var newhtml=$(".north").prepend(html).html().replace(/'/g,"''");
16            $.ajax({
17                type: "POST",
18                url: "action.asp",
19                data: "act=phsave&ph="+escape(newhtml)+"&topval="+escape(topval)+"&sid=<%=id%>&p="+Math.random(),
20                success: function(msg){
21                  $("textarea").val("");
22                  $("tr[id='tr"+<%=id%>+"'] td:eq(8)",window.dialogArguments.document).html(topval);
23                }
24             });
25        }
26     });
View Code

 

 

下图为运行结果,点击列表图标打开模式窗口,在添加记事窗口录入内容点击增加,实现将内容更新到父窗口当前行指定单元格内;

 

 

 

转载于:https://www.cnblogs.com/webczw/p/3328719.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值