tabs - javascript failing in HTA -
i trying life of me make tabs work in hta. if can spot error here awesome. says im getting undefined variable when launch. below code hta. im not sure error coming from. believe has "panels" in javascript..
<html> <head> <hta:application id="accessportal" applicationname="accessportal" border = "thin" borderstyle = "normal" caption = "yes" innerborder="no" maximizebutton = "no" minimizebutton = "yes" navigable="yes" scroll="yes" selection="yes" showintaskbar = "yes" singleinstance = "yes" sysmenu = "yes" version = "1.0" /> <title>access portal</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <!-- window resize vbs --> <script language="vbscript"> sub window_onload window.resizeto 1100,625 end sub </script> <!-- username print --> <script language="vbscript"> sub getusername() set wshnetwork = createobject("wscript.network") 'now grab user's windows loginid , 'save variable getuser use later in pasting dim getuser getuser = wshnetwork.username set wshnetwork = nothing user.innerhtml = getuser end sub </script> <!-- establish excel communication --> <script language="vbscript"> sub tallysportsbottle() curdate = dim oxlapp, wb, ws '~~> define xlup const xlup = -4162 set objexcel = createobject("excel.application") objexcel.application.visible = true set objworkbook = objexcel.workbooks.open("c:\users\gloria vena\desktop\new2\excel\access portal issues report.xlsx") set ws = objworkbook.worksheets(1) ws lastrowindex = .cells(.rows.count, "a").end(xlup).row .cells(lastrowindex + 1, 1) = curdate end objexcel.activeworkbook.save objexcel.activeworkbook.close objexcel.application.quit end sub </script> <script language="javascript"> //message of day // variable contains path , filename of motd text file. // make sure type '\\' each '\'; e.g. \\\\server\\share\\file // if specify filename without preceding path, hta // file in same directory hta. var message_file_name = "motd.txt"; // function executes when body has finished loading. function executeapp() { var fso, appdir, messagefile, ts, messagetext, line; fso = new activexobject("scripting.filesystemobject"); // if message_file_name doesn't contain path, assume it's // in same directory hta. if (message_file_name.indexof("\\") == -1) { // use unescape in case application's path contains spaces. appdir = unescape(fso.getparentfoldername(location.pathname)); messagefile = fso.buildpath(appdir, message_file_name); } else { messagefile = message_file_name; } try { // open message-of-the-day file textstream. ts = fso.opentextfile(messagefile, 1); messagetext = ""; while (! ts.atendofstream) { line = ts.readline(); // if line contains text, enclose in <p> element; // otherwise, construct blank line nonbreaking space. if (line.length > 0) line = line.replace(/^(.*)$/, "$1"); else line = "<p> </p>"; messagetext += line; } ts.close(); } // construct error message if error occurred. catch(err) { messagetext = "<p>can't display message of day.</p>" + "<p> </p>" + "<p>error <b>0x" + hex(err.number) + "</b><br />" + err.description + "</p>"; } // update innerhtml element of textarea element // message text. document.getelementbyid("messagetext").innerhtml = messagetext; // use line of code below automatically close hta // after specified number of milliseconds. // window.settimeout("window.close();", 30000); } </script> <script type="text/javascript"> //tab control js var panels = new array("","panel1","panel2","panel3","panel4","panel5"); function panel(tab) { (i=1; i<panels.length; i++) { if (i == tab) { document.getelementbyid("tab"+i).classname = "tabs tabs1"; document.getelementbyid("panel"+i).style.display = "block"; } else { document.getelementbyid("tab"+i).classname = "tabs tabs0"; document.getelementbyid("panel"+i).style.display = "none"; } } } </script> <!-- tab css --> <style type="text/css"> .tabs { border-collapse: collapse; color: black; cursor: pointer; cursor: hand; font-family: arial; font-size: 9pt; font-weight: bold; margin-top: 4px; padding: 2px 4px 0px 4px; position: relative; text-align: center; text-decoration: none; z-index: 1; } .tabs0 { background-color: wheat; border: solid 1px black; } .tabs1 { background-color: white; border-color: black black white black; border-style: solid solid solid solid; border-width: 1px 1px 1px 1px; } </style> </head> <body onload="executeapp()"> <div align="center" class="container"> <div class="header"> <div class="h_logo"> <img src="img/logo.jpg" width="148px" height="80px"></> </div> <div class="h_text"> access portal </div> <br /> <div class="topmenu"> <ul> <li><span class="tabs tabs1" id="tab1" onclick="panel(1)">tab1</span></li> <li><span class="tabs tabs1" id="tab1" onclick="panel(2)">tab2</span></li> <li><span class="tabs tabs1" id="tab1" onclick="panel(3)">tab3</span></li> <li><span class="tabs tabs1" id="tab1" onclick="panel(4)">tab4</span></li> <li><span class="tabs tabs1" id="tab1" onclick="panel(5)">tab5</span></li> </ul> <br /> </div> </div> <div class="pagecontent"> <div class="panel" id="panel1" style="display:block"> <span class="header1">hello, <span id="user">name</span>!</span> <br /> <span class="text1">please select program wish launch.</span> <div class="leftcontainer"> <div class="appmenu"> <ul> <li><a href="#">open programs</a></li> <li><a href="#">manager</a></li> <li><a href="#">capture</a></li> <li><a href="#">manager2</a></li> <li><a href="#">website</a></li> <li><a href="#">suite</a></li> <li><a href="#">service</a></li> <li><a href="#">co</a></li> <li><a href="#">microsoft outlook</a></li> </ul> </div> </div> <div class="rightcontainer"> <div class="rightbox"> <span class="header1">important information:</span> <br /> <div class="messagebox"> <span id="messagetext"></span> </div> </div> <div class="botbox"> <a class="button green" href="#" onclick="tallysportsbottle()">+1</a> </div> </div> </div> <br/> <div class="panel" id="panel2" style="display:hidden"> <span class="header1">hello, <span id="user">name</span>!</span> <br /> <span class="text1">please select program wish launch.</span> <div class="leftcontainer"> <div class="appmenu"> <ul> <li><a href="#">open programs</a></li> <li><a href="#">manager</a></li> <li><a href="#">capture</a></li> <li><a href="#">manager2</a></li> <li><a href="#">website</a></li> <li><a href="#">suite</a></li> <li><a href="#">service</a></li> <li><a href="#">co</a></li> <li><a href="#">microsoft outlook</a></li> </ul> </div> </div> <div class="rightcontainer"> <div class="rightbox"> <span class="header1">important information:</span> <br /> <div class="messagebox"> <span id="messagetext"></span> </div> </div> <div class="botbox"> <a class="button green" href="#" onclick="tallysportsbottle()">+1</a> </div> </div> </div> <br/> <div class="panel" id="panel3" style="display:hidden"> <span class="header1">hello, <span id="user">name</span>!</span> <br /> <span class="text1">please select program wish launch.</span> <div class="leftcontainer"> <div class="appmenu"> <ul> <li><a href="#">open programs</a></li> <li><a href="#">manager</a></li> <li><a href="#">capture</a></li> <li><a href="#">manager2</a></li> <li><a href="#">website</a></li> <li><a href="#">suite</a></li> <li><a href="#">service</a></li> <li><a href="#">co</a></li> <li><a href="#">microsoft outlook</a></li> </ul> </div> </div> <div class="rightcontainer"> <div class="rightbox"> <span class="header1">important information:</span> <br /> <div class="messagebox"> <span id="messagetext"></span> </div> </div> <div class="botbox"> <a class="button green" href="#" onclick="tallysportsbottle()">+1</a> </div> </div> </div> <br/> <div class="panel" id="panel4" style="display:hidden"> <span class="header1">hello, <span id="user">name</span>!</span> <br /> <span class="text1">please select program wish launch.</span> <div class="leftcontainer"> <div class="appmenu"> <ul> <li><a href="#">open programs</a></li> <li><a href="#">manager</a></li> <li><a href="#">capture</a></li> <li><a href="#">manager2</a></li> <li><a href="#">website</a></li> <li><a href="#">suite</a></li> <li><a href="#">service</a></li> <li><a href="#">co</a></li> <li><a href="#">microsoft outlook</a></li> </ul> </div> </div> <div class="rightcontainer"> <div class="rightbox"> <span class="header1">important information:</span> <br /> <div class="messagebox"> <span id="messagetext"></span> </div> </div> <div class="botbox"> <a class="button green" href="#" onclick="tallysportsbottle()">+1</a> </div> </div> </div> <br/> <div class="panel" id="panel5" style="display:hidden"> <span class="header1">hello, <span id="user">name</span>!</span> <br /> <span class="text1">please select program wish launch.</span> <div class="leftcontainer"> <div class="appmenu"> <ul> <li><a href="#">open programs</a></li> <li><a href="#">manager</a></li> <li><a href="#">capture</a></li> <li><a href="#">manager2</a></li> <li><a href="#">website</a></li> <li><a href="#">suite</a></li> <li><a href="#">service</a></li> <li><a href="#">co</a></li> <li><a href="#">microsoft outlook</a></li> </ul> </div> </div> <div class="rightcontainer"> <div class="rightbox"> <span class="header1">important information:</span> <br /> <div class="messagebox"> <span id="messagetext"></span> </div> </div> <div class="botbox"> <a class="button green" href="#" onclick="tallysportsbottle()">+1</a> </div> </div> </div> <br/> </div> </div> </body> </html>
Comments
Post a Comment