• 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(/
    /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

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

  • 相关阅读:
    Codeforces 358 D. Dima and Hares
    sublime Text3配置及快捷键、插件推荐总结
    免费WiFi,仅仅为好久没联系的你们
    史上最简单的带流控功能的http server
    微软2014校园招聘笔试试题
    python 3Des 加密
    MySQL slave状态之Seconds_Behind_Master
    APP安全环节缺失,手游运营商怎样应对APP破解困境
    读完了csapp(中文名:深入理解计算机系统)
    static使用方法小结
  • 原文地址:https://www.cnblogs.com/webczw/p/3328719.html
Copyright © 2020-2023  润新知