以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  Cannot read property 'setAttribute' of null  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=171366)

--  作者:benben325
--  发布时间:2021/8/27 16:17:00
--  Cannot read property 'setAttribute' of null
下面这段代码报错:Cannot read property \'setAttribute\' of null
With wb.AddTabBar("page1", "tb1", 1)
    .AddPage("mainage1","单据报表")
    .AddPage("mainage2","明细报表")
    .AddPage("mainage3","跟踪报表")
End With

wb.InsertHTML(<script>document.getElementById(\'mainage1\').style.display=\'none\';document.getElementById(\'mainage2\').style.display=\'block\';document.getElementById(\'mainage3\').style.display=\'none\';document.getElementById(\'mainage1_btn name=\').setAttribute(\'class\',\'weui_tabbar_item\');document.getElementById(\'mainage2_btn name=\').setAttribute(\'class\',\'weui_tabbar_item weui_bar_item_on\');document.getElementById(\'mainage3_btn name=\').setAttribute(\'class\',\'weui_tabbar_item\');</script>")

--  作者:有点蓝
--  发布时间:2021/8/27 16:21:00
--  
建议还是使用js文件,方便在浏览器里调试

不存在这个id
document.getElementById(\'mainage1_btn name=\').