以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] js函数参数用变量 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=159103) |
-- 作者:foxtablefanse -- 发布时间:2020/12/14 10:35:00 -- [求助] js函数参数用变量 .AfterSelChange = "dynaActiveSheet(" & e.Cookies("userName") & ")" \'括号内的引用怎么写? |
-- 作者:有点蓝 -- 发布时间:2020/12/14 10:41:00 -- .AfterSelChange = "dynaActiveSheet(\'" & e.Cookies("userName") & "\')" |
-- 作者:foxtablefanse -- 发布时间:2020/12/14 10:48:00 -- 谢谢 |
-- 作者:foxtablefanse -- 发布时间:2020/12/14 11:58:00 -- function dynaActiveSheet(uname){ if(table1.rows[table1.rowSel].cells[2].innerHTML=="总计" || table1.rows[table1.rowSel].cells[10].innerHTML==uname ){ hide("menu"); } else { show("menu"); } } 这样写应该没有问题啊?
|
-- 作者:有点蓝 -- 发布时间:2020/12/14 13:33:00 -- function dynaActiveSheet(uname){ akert(uname); akert(table1.rows[table1.rowSel].cells[2].innerHTML); akert(table1.rows[table1.rowSel].cells[10].innerHTML); if(table1.rows[table1.rowSel].cells[2].innerHTML=="总计" || table1.rows[table1.rowSel].cells[10].innerHTML==uname ){ hide("menu");
|
-- 作者:foxtablefanse -- 发布时间:2020/12/14 14:53:00 -- 奇怪的很,查出数据,动态菜单没有起作用,不弹出消息,是哪里问题?? Case "LuDanList2.htm" \'路单-列表2 筛选生成 ..... \'合成网页 wb.InsertHTML("","<div id=\'div1\' style=\'overflow-x:auto;width:200%\'>") With wb.AddTable("","Table1") .PageNumber = page \'设置页码 .Primarykey = "_Identify" \'设置主键 .CreateFromDataTable(dt) \'生成汇总行 If EndRow >= Count Then .Body.AddRow("","","总计","","","","","","",Format(je,"#0.00"),"", Format(shj,"#0.0"),"","").Attribute = "style=\'background-color:#FFFF00\'" End If .AfterSelChange = "dynaActiveSheet(\'" & e.Cookies("uname") & "\')" \'置顶选择不同单元格后要执行的js行数,注意区分大小写 \'设置表格样式 .ColWidth = "12px,120px,100px,120px,120px,150px,150px,150px,120px,100px,100px,40px,150px,100px" \'设置列宽 .Highlight = 1 \'高亮显示 .Alternate = 2 \'每两行显示一个不同背景颜色的行 .RowHead = 1 .ActiveSheet = "menu" \'指定菜单 End With wb.InsertHTML("","</div>") With wb.AddButtonGroup("","btg2", False) If page > 0 Then .Add("btnFirst", "第一页","","LuDanList2.htm?page=0") .Add("btnPrev", "上一页","","LuDanList2.htm?page=" & page - 1) Else .Add("btnFirst", "第一页","button").Kind = 1 .Add("btnPrev", "上一页","button").Kind = 1 End If If Endrow < count Then .Add("btnNext", "下一页","","LuDanList2.htm?page=" & page + 1) .Add("btnLast", "最末页","","LuDanList2.htm?page=" & pages - 1) Else .Add("btnNext", "下一页","button").Kind = 1 .Add("btnLast", "最末页","button").Kind = 1 End If End With With wb.AddButtonGroup("","btg3", False) If flt = "" Then .Add("btnflt", "筛选", "","LuDanFilter2.htm").kind = 1 Else .Add("btnunflt", "重新筛选", "","LuDanFilter2.htm") .Add("btnunflt", "取消筛选", "","index.htm") End If End With With wb.AddActionSheet("","menu") \'设计菜单 .Add("mnuCopy", "复制路单").Attribute ="on click=\'copy(""mnuCopy2"")\'" \'"mnuCopy2" \'分类,多个页面的菜单提交到复制页面,用于在复制页面区分是从哪个页面提交的. .Add("mnuEdit", "编辑路单").Attribute ="on click=\'edit()\'" .Add("mnuDelete", "删除路单").Attribute ="on click=\'del()\'" End With wb.AppendHTML("<script src=\'./lib/anqy1.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'================================合计行和非本人数据不弹出菜单 function dynaActiveSheet(uname){ alert(uname); alert(table1.rows[table1.rowSel].cells[2].innerHTML); alert(table1.rows[table1.rowSel].cells[13].innerHTML); if(table1.rows[table1.rowSel].cells[2].innerHTML=="总计" || table1.rows[table1.rowSel].cells[13].innerHTML!=uname ){ hide("menu"); } else { show("menu"); } } [此贴子已经被作者于2020/12/14 14:58:44编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/12/14 15:03:00 -- 改为双引号 .AfterSelChange = "dynaActiveSheet(""" & e.Cookies("uname") & """)"
|
-- 作者:foxtablefanse -- 发布时间:2020/12/14 15:16:00 -- 完美!!谢谢蓝版!!!!!!!!!! |
-- 作者:foxtablefanse -- 发布时间:2020/12/14 15:23:00 -- 以下是引用有点蓝在2020/12/14 15:03:00的发言:
改为双引号 .AfterSelChange = "dynaActiveSheet(""" & e.Cookies("uname") & """)" [此贴子已经被作者于2020/12/14 15:26:55编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/12/14 15:36:00 -- 做个例子发上来测试一下 |