以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  执行网页代码,js,alert("OK");不显示  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=99966)

--  作者:zhangjian222200
--  发布时间:2017/5/1 21:06:00
--  执行网页代码,js,alert("OK");不显示
说明:我是在原能执行代码基础上,修改的,加了AddTabBar,为下面各控件加了bt3,发现js文件的alert("OK");不显示

下面是页面per_quyu.htm的代码:
Dim e As RequestEventArgs = args(0)                            \'注册第4页,区域信息
Dim wb As New weui
With wb.AddTabBar("", "tb1",0)                            \'使用TabBar,增加4个按钮(注:页面可以增加,但不考虑)
    .AddButton("bt1","首页","./images/a.png","/index.htm") 
    .AddButton("bt2","设置","./images/b.png","/per_chakanshezhi.htm")
    .Addpage("bt3","当前","./images/c.png")
    .AddButton("bt4","我的","./images/d.png","/personal.htm")
    \'.Attribute = "style=\'height:55px\'"
End With
wb.AddTopTips("bt3","toptip1","") \'用于显示动态错误提示
With wb.AddArticle("bt3","ar1")
    .AddImage("./images/langwo/logo1.jpg")
    .Attribute = "style=\'padding:0em;\'"
End With
wb.AddForm("bt3","form1","per_quyu.htm").Attri-bute="on-submit=\'return validit_per_quyu()\'" 
With wb.AddInputGroup("bt3","ipg1","所在区域")
    With .AddSelect("szs","所在省","|" & DataTables("城市列表").sqlGetComboListString("所在省"))
        .Attribute = "on-change=""setAjaxOptions(\'szshi\',\'p_quyu_get.htm\',\'szs\',false)"""  ’这里取值正常
    End With
    With .AddSelect("szshi","所在市","")
        .Attribute = "on-change=""setAjaxOptions(\'szqx\',\'p_quyu_get.htm\',\'szs\',\'szshi\',false)"""  ’这里取值正常
    End With
    .AddSelect("szqx","所在区县","")
End With

With wb.AddInputGroup("bt3","ipg2","家乡区域")
    With .AddSelect("jxs","家乡省","|" & DataTables("城市列表").sqlGetComboListString("所在省"))
        .Attribute = "on-change=""setAjaxOptions(\'jxshi\',\'p_quyu_get.htm\',\'jxs\',false)"""  ’这里取值正常
    End With
    With .AddSelect("jxshi","家乡市","")
        .Attribute = "on-change=""setAjaxOptions(\'jxqx\',\'p_quyu_get.htm\',\'jxs\',\'jxshi\',false)"""  ’这里取值正常
    End With
    .AddSelect("jxqx","家乡区县","")
    With wb.AddButtonGroup("bt3","btg2",True)
        .Add("btn1", "确定","submit")
    End With
End With

wb.AppendHTML("<script s-rc=\'./lib/ajaxform_per_quyu.js\'></script>") \'引入脚本文件
e.WriteString(wb.Build)  \'生成网页


下面是js代码:(js的文件的路径是对的,文件名是:ajaxform_per_quyu.js)
function validit_per_quyu(){
    alert("OK");   ’执行上述代码,这个ok不显示
    var result=submitAjaxFileds("p_per_quyu.htm","","szs","szshi","szqx","jxs","jxshi","jxqx",false);
    if(result=="OK"){
        return true;
    }
    else{
        showTopTips("toptip1",result,2000);
        return false;
    }
}

[此贴子已经被作者于2017/5/1 21:09:46编辑过]

--  作者:有点色
--  发布时间:2017/5/2 11:45:00
--  

 你贴出的代码没有问题。

 

 请确认你的js文件没有其余代码。

 

 你要学会用浏览器调试啊,浏览器提示什么错误?


--  作者:zhangjian222200
--  发布时间:2017/5/2 14:51:00
--  
1楼代码,经过如下几处粉色跳转,就正常了,js执行正常,实际就是父id问题
Dim e As RequestEventArgs = args(0)                            \'注册第4页,区域信息
Dim wb As New weui
\'With wb.AddTabBar("", "tb1",0)                            \'将TabBar屏蔽
    \'.AddButton("bt1","首页","./images/a.png","/index.htm")  \'.Attribute = ""
    \'.AddButton("bt2","设置","./images/b.png","/per_chakanshezhi.htm")
    \'.Addpage("bt3","当前","./images/c.png")
    \'.AddButton("bt4","我的","./images/d.png","/personal.htm")
    \'\'.Attribute = "style=\'height:55px\'"
\'End With

wb.AddTopTips("","toptip1","") \'用于显示动态错误提示  ’去掉bt3
With wb.AddArticle("","ar1")  ’去掉bt3
    .AddImage("./images/langwo/logo1.jpg")
    .Attribute = "style=\'padding:0em;\'"
End With

wb.AddForm("","form1","per_quyu.htm").Attri-bute="on-submit=\'return validit_per_quyu()\'"  ’去掉bt3
With wb.AddInputGroup("form1","ipg1","所在区域")  ’去掉bt3,改为form1
    With .AddSelect("szs","所在省","|" & DataTables("城市列表").sqlGetComboListString("所在省"))
        .Attribute = "on-change=""setAjaxOptions(\'szshi\',\'p_quyu_get.htm\',\'szs\',false)"""
    End With
    With .AddSelect("szshi","所在市","")
        .Attribute = "on-change=""setAjaxOptions(\'szqx\',\'p_quyu_get.htm\',\'szs\',\'szshi\',false)"""
    End With
    .AddSelect("szqx","所在区县","")
End With

With wb.AddInputGroup("form1","ipg2","家乡区域")  ’去掉bt3,改为form1
    With .AddSelect("jxs","家乡省","|" & DataTables("城市列表").sqlGetComboListString("所在省"))
        .Attribute = "on-change=""setAjaxOptions(\'jxshi\',\'p_quyu_get.htm\',\'jxs\',false)"""
    End With
    With .AddSelect("jxshi","家乡市","")
        .Attribute = "on-change=""setAjaxOptions(\'jxqx\',\'p_quyu_get.htm\',\'jxs\',\'jxshi\',false)"""
    End With
    .AddSelect("jxqx","家乡区县","")
    With wb.AddButtonGroup("form1","btg2",True)  ’去掉bt3,改为form1
        .Add("btn1", "确定","submit")
    End With
End With

wb.AppendHTML("<script src=\'./lib/ajaxform_per_quyu.js\'></script>") \'引入脚本文件
e.WriteString(wb.Build)  \'生成网页

像1楼代码那样,加上tabbar,可以实现同样的功能吗?
[此贴子已经被作者于2017/5/2 14:54:13编辑过]

--  作者:有点色
--  发布时间:2017/5/2 15:24:00
--  

 我这样测试没问题

 

         Dim wb As New weui
        With wb.AddTabBar("", "tb1",0)                            \'使用TabBar,增加4个按钮(注:页面可以增加,但不考虑)
            .AddButton("bt1","首页","./images/a.png","/index.htm")
            .AddButton("bt2","设置","./images/b.png","/per_chakanshezhi.htm")
            .Addpage("bt3","当前","./images/c.png")
            .AddButton("bt4","我的","./images/d.png","/personal.htm")
            \'.Attribute = "style=\'height:55px\'"
        End With
        wb.AddTopTips("bt3","toptip1","") \'用于显示动态错误提示
        With wb.AddArticle("bt3","ar1")
            .AddImage("./images/langwo/logo1.jpg")
            .Attribute = "style=\'padding:0em;\'"
        End With
        wb.AddForm("bt3","form1","per_quyu.htm").Attribute="onsubmit=\'return validit_per_quyu()\'"
        With wb.AddInputGroup("form1","ipg1","所在区域")
            With .AddSelect("szs","所在省","|123|3434")
            End With
        End With
        With wb.AddButtonGroup("form1","btg2",True)
            .Add("btn1", "确定","submit")
        End With
        wb.AppendHTML("<script src=\'./lib/test.js\'></script>") \'引入脚本文件
        e.WriteString(wb.Build) \'生成网页

[此贴子已经被作者于2017/5/2 15:25:28编辑过]