下图为父窗口,点击图片事件,打开模式窗口,传入当前行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 });
下图为打开后模式窗口的增加按钮事件
1 $("#bon_add").click(function(e) { 2 var html = $("textarea").val(); 3 if(html!=""){ 4 html=html.replace(/&/g,"&"); 5 html=html.replace(/</g,"<"); 6 html=html.replace(/>/g,">"); 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 });
下图为运行结果,点击列表图标打开模式窗口,在添加记事窗口录入内容点击增加,实现将内容更新到父窗口当前行指定单元格内;