Foxtable(狐表)用户栏目专家坐堂 → js模拟点击事件


  共有2073人关注过本帖树形打印复制链接

主题:js模拟点击事件

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/8/4 8:52:00 [显示全部帖子]

请上传视实例测试

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/8/4 10:22:00 [显示全部帖子]

list.html,js脚本改改

<script type="text/javascript">

        function dd(val) {

            var htm = parent.document.getElementById("product_details").innerHTML

            parent.document.getElementById('mask').style.opacity = "1";
            var s = "\'";
            s = '<li id="' + val.id + '">';
            k = '<li id="' + val.id + '"><div> <div style=" float:left; width:20%;"> ';
            k = k + ' <img class=+ "\'"weui_media_appmsg_thumb+ "\'" src=+ "\'"./images/search.png+ "\'"/></div><div><h4 >' + document.getElementById(val.id).innerHTML + '</h4><p>';
            k = k + '数量<input id="sl' + val.id + '" type="number" value="1" style=" border: none" read/>单价<input id="dj' + val.id + '" type="number" value="3" style=" border: none" read/></p></div> </div> </li>';


            if (htm.indexOf(s) > -1) { alert(document.getElementById(val.id).innerHTML + '存在'); }
            else {
                parent.document.getElementById("product_details").innerHTML = htm + k;
            }

        }


        function aaa() {
            document.getElementById('p1').style.display = 'block'
            var result = submitAjaxFileds("getBrands.htm", "", "单位", "开户银行", "账号", false);
            var $p1 = document.getElementById("p1")
            $p1.innerHTML = result;
            $p1.querySelectorAll("li").forEach(function (val) {

                var sub = parent.document.getElementById("cancel");
                var btn = document.getElementById(val.id);
                btn.onclick = function () {
                    dd(val);
                    alert('aaa');
                    sub.click();
                }
            });
        }
    </script>

后台去掉click
Dim fl As String =  ProjectPath & "mui\"  & e.path

e.AsyncExecute = True  '通知系统,将采用异步方式生成网页

If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String  = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css",".html",".htm",".zip",".rar"
            e.WriteFile(fl)
            Return '这里必须返回
    End Select
End If
Select Case e.Path
    Case  "getBrands.htm"
        Dim sb As New StringBuilder
        Dim drs As List(of DataRow)  = DataTables("供应商表").SQLSelect("  单位 like '%" & e.PostValues("单位") & "%'   ")
        For Each dr As DataRow In drs
            sb.Append("<li id=""" & dr("开户银行")  & """ >" &  dr("开户银行") & "|" & dr("账号") & "</li> ")
        Next
        e.WriteString(sb.ToString)
End Select
e.Handled = True


 回到顶部