For Each dr As DataRow In drs
...
...
...
.RightFooter.AddFoot("选课").Attribute = "style=""color: #206040;font-size:18px;width:30px;writing-mode: horizontal-tb;padding-right:20px;"" & openid & "','" & dr("课程名称") & "','" & dr("课程类别") & "','" & dr("授课老师") & "','" & dr("授课时段") & "')"""
Next
With wb.AddDialog("", "dlg1", "约课确认", "您确定约课吗?")
.AddButton("btnCancel", "取消").Kind = 1
.AddButton("btnOK", "确定").Attribute = """
End With
我想在点击选课按钮后,先show('dlg1'),如果点是,再运行sendjosnobject函数,但是如果这样是不是需要额外新建几个变量,在点击的时候进行赋值才行。上边代码需要怎样修改?
.RightFooter.AddFoot("选课").Attribute = "style=""color: #206040;font-size:18px;width:30px;writing-mode: horizontal-tb;padding-right:20px;"" onclick=""某函数('" & openid & "," & dr("课程名称") & "," & dr("课程类别") & "," & dr("授课老师") & "," & dr("授课时段") & "')"""
js文件-----------
var 某全局变量;
function 某函数(a){
某全局变量 = a;
show('dlg1');
}
function queren(){
var aa = 某全局变量.split(",");
sendJsonObject(...aa);
}
[此贴子已经被作者于2024/7/22 16:38:46编辑过]
dim a as string
dim b as string
dim c as string
For Each dr As DataRow In drs
...
...
...
a=dr("课程名称")
b=dr("课程类别")
c=dr("授课老师")
.RightFooter.AddFoot("选课").Attribute = "style=""color: #206040;font-size:18px;width:30px;writing-mode: horizontal-tb;padding-right:20px; on click=""show('dlg1')""
Next
With wb.AddDialog("", "dlg1", "约课确认", "您确定约课吗?")
.AddButton("btnCancel", "取消").Kind = 1
.AddButton("btnOK", "确定").Attribute = "on click=""sendJsonObject(a,b,c)"""
End With
这样可以吗?提前先设置几个变量 ,这几个变量能不能保证是点击的那条数据中的
var openid; //后台传过来的所有参数
var kcmc;
var kclb;
var skls;
var sksd;
function sendJsonObject(openid,kcmc,kclb,skls,sksd){
openid=openid;
kcmc=kcmc;
kclb=kclb;
skls=skls;
sksd=sksd;
console.log(kcmc);
show('dlg1');
// show("tst1",2000);
}
function queren(){ //向后台发送数据
show("tst1",2000);
console.log(kcmc);
var obj=new Object();
obj.openid = openid;
obj.kcmc=kcmc;
obj.kclb=kclb;
obj.skls=skls;
obj.sksd=sksd;
var result = sendAjaxJSON(obj,"yuekejieshou.htm",'aftersubmit',false);
}
第一个黄色部分还可以正常显示,第二个就显示未定义了,咋回事
这些js都必须在同一个文件里,把全局变量的定义放到文件最前面。函数里的参数名称不要和全局变量名称一样
With wb.AddDialog("", "dlg1", "约课确认", "您确定约课吗?")
.AddButton("btnCancel", "取消").Kind = 1
.AddButton("btnOK", "确定").Attribute = """
End With
这个点完确认或者取消,为什么对话框不关闭。
对话框放到主页面里,不能放到通过ajax返回的页面