I got an error in JavaScript when I open my website in Chrome or MSEdge. Error is Uncaught TypeError: Cannot read properties of null (reading ‘toLowerCase’). When I open in Internet Explorer 11, it’s working perfectly. But in Chrome, when i click on tabs in Navbar, it got JS errors. May I know how can I fix that? I will insert both html and JavaScript.
<?php
include("_include/checklogin.php");
include("_config.php");
echo "<html>";
echo "<head><title>" . $toolsname . "</title>";
echo "<link rel="stylesheet" type="text/css" href="web/jquery/css/custom-theme/jquery-ui-1.8.6.custom.css"/>";
echo "<script src="web/jquery/js/jquery-1.4.4.min.js" type="text/javascript"></script>";
echo "<script src="web/jquery/js/jquery-ui-1.8.6.custom.min.js" type="text/javascript"></script>";
echo "<script src="web/jquery/js/pointer_edge.js" type="text/javascript"></script>";
echo "<link rel="stylesheet" type="text/css" href="web/jquery/css/global.css">";
echo "<link rel="stylesheet" type="text/css" href="_local.css"/>";
echo "<script src="_tabadd.js" type="text/javascript"></script>";
echo "<script src="_tabedit.js" type="text/javascript"></script>";
echo "<script src="_tabhist.js" type="text/javascript"></script>";
echo "<script src="_tabProbSearch.js" type="text/javascript"></script>";
echo "<script src="probEquipProgram/_tabProbEquip.js" type="text/javascript"></script>";
echo "<script src="_common.js" type="text/javascript"></script>";
echo "</head>";
echo "<body>";
//include ($_SERVER['DOCUMENT_ROOT'] . "librarycommonapewsheader.php");
include("//sgewsnant21.amk.st.com/ewsweb/wwwroot/library/common7/apewsheader.php");
echo "<form name="equipment" method="post" target="_self">";
echo "<div class="divprojname">" . $toolsname . "</div>";
//<p align=center style="margin-top: -20px;"><font color=red size=3px><b>**Please Add New Equipment to ePCR**</b></font></p>
echo "<div class="divcontainer">";
echo "<div id=tabs style="width=100%;">";
echo "<ul>";
echo "<li><a href="#tabs-1">Edit Equipment</a></li>";
echo "<li><a href="#tabs-2">Add Equipment</a></li>";
echo "<li><a href="#tabs-3">Queue for Approval</a></li>";
echo "<li><a href="#tabs-4">History</a></li>";
echo "<li><a href="#tabs-5">Equip Config</a></li>";
echo "<li><a href="#tabs-6">Prober Search Tool</a></li>";
echo "<li><a href="#tabs-7">Prober Equipment Program</a></li>";
echo "</ul>";
echo "<div id=tabs-1>"; include("tabedit_filter.php"); echo "</div>";
echo "<div id=tabs-2>"; include("tabadd_form.php"); echo "</div>";
echo "<div id=tabs-3>"; include("tabque.php"); echo "</div>";
echo "<div id=tabs-4>"; include("tabhist_filter.php"); echo "</div>";
echo "<div id=tabs-5>";
echo "<table cellpadding=2 cellspacing=2 align=center width=500px>";
echo "<tr>";
echo "<td>";
echo "<table cellpadding=0 cellspacing=0 width=100% style="border: 1px solid navy;">";
echo "<tr>";
echo "<td nowrap valign=middle width=100% style="border-bottom: 1px solid" bgcolor=#6699CC>";
echo "<table border=0 cellpadding=2 cellspacing=2>";
echo "<tr><td><font class=ft10 color=navy><b>Tester and Prober Configuration</b></font></td></tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td nowrap valign=middle width=100%>";
echo "<table border=0 cellpadding=2 cellspacing=2 width=90%>";
echo "<tr>";
// echo "<td align=left width="10%"> <a href="javascript:void();" onclick="javascript:FileDownload('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/APEWS_Testers_Config.xls');"><img border="0" src="".$grpnicon."xls.gif"></a></td>";
echo "<td align=left width="10%"> <a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/APEWS_Testers_Config.xlsx','_blank');"><img border="0" src="".$grpnicon."xls.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>APEWS Tester Configuration</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left width="10%"><a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/TEL - Configurations.pdf', '_blank')"><img border="0" src="".$grpnicon."pdf.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>TEL Configuration</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left width="10%"><a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/ACCRETECH - Configurations.pdf', '_blank')"><img border="0" src="".$grpnicon."pdf.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>ACCRETECH Configuration</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left width="10%"><a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/SEMICS - Configurations.pdf', '_blank')"><img border="0" src="".$grpnicon."pdf.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>SEMICS Configuration</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left width="10%"><a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/EG - Configurations.pdf', '_blank')"><img border="0" src="".$grpnicon."pdf.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>EG - Configurations</font></td>";
echo "</tr>";
// echo "<tr>";
// echo "<td align=left width="10%"> <a href="javascript:void();" onclick="javascript:FileDownload('d:/webdata/tpmc/report/equip/EWS GRR Masterlist.xlsx');"><img border="0" src="".$grpnicon."xls.gif"></a></td>"; //closed requested by Audie
// echo "<td align=left width="90%"><font class=ft10 color=#000000>EWS GR&R Masterlist</font></td>";
// echo "</tr>";
echo "<tr>";
echo "<td align=left width="10%"> <a href="javascript:void();" onclick="window.open('http://sgewsweb.amk.st.com/webdata/tpmc/report/equip/Calibration Service Providers Certificates', '_blank')"><img border="0" src="".$grpnicon."service.gif"></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>CAL Service Providers Certificates</font></td>";//W:ReportequipCalibration Service Providers Certificates
echo "</tr>";
if($badgeno == "018359" || $badgeno == "018432" || $badgeno == "016919" || $badgeno == "230933"){
echo "<tr>";
echo "<td align=left width="10%"> <a href="javascript:void();" onclick="Upload();"><img border="0" src="".$grpnicon."upload.jpg" width=40px height=40px></a></td>";
echo "<td align=left width="90%"><font class=ft10 color=#000000>Upload RnR Report</font></td>";
echo "</tr>";
}
//end
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<div id=tabs-6>"; include("tabProbSearch_filter.php"); echo "</div>";
echo "<div id=tabs-7>"; include("probEquipProgram/tabProbEquip_filter.php"); echo "</div>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</body>";
echo "</html>";
?>
Below codes are JavaScript codes. Error line is under 4.1.
/**
* This array is used to remember mark status of rows in browse mode
*/
var marked_row = new Array;
/**
* Sets/unsets the pointer and marker in browse mode
*
* @param object the table row
* @param interger the row number
* @param string the action calling this script (over, out or click)
* @param string the default background color
* @param string the color to use for mouseover
* @param string the color to use for marking a row
*
* @return boolean whether pointer is set or not
*/
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
var theCells = null;
// 1. Pointer and mark feature are disabled or the browser can't get the
// row -> exits
if ((thePointerColor == '' && theMarkColor == '')
|| typeof(theRow.style) == 'undefined') {
return false;
}
// 2. Gets the current row and exits if the browser can't get it
if (typeof(document.getElementsByTagName) != 'undefined') {
theCells = theRow.getElementsByTagName('td');
}
else if (typeof(theRow.cells) != 'undefined') {
theCells = theRow.cells;
}
else {
return false;
}
// 3. Gets the current color...
var rowCellsCnt = theCells.length;
var domDetect = null;
var currentColor = null;
var newColor = null;
// 3.1 ... with DOM compatible browsers except Opera that does not return
// valid values with "getAttribute"
if (typeof(window.opera) == 'undefined'
&& typeof(theCells[0].getAttribute) != 'undefined') {
currentColor = theCells[0].getAttribute('bgcolor');
domDetect = true;
}
// 3.2 ... with other browsers
else {
currentColor = theCells[0].style.backgroundColor;
domDetect = false;
} // end 3
// 4. Defines the new color
// 4.1 Current color is the default one
if (currentColor == ''
|| currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
if (theAction == 'over' && thePointerColor != '') {
newColor = thePointerColor;
}
else if (theAction == 'click' && theMarkColor != '') {
newColor = theMarkColor;
}
}
// 4.1.2 Current color is the pointer one
else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
&& (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
if (theAction == 'out') {
newColor = theDefaultColor;
}
else if (theAction == 'click' && theMarkColor != '') {
newColor = theMarkColor;
marked_row[theRowNum] = true;
}
}
// 4.1.3 Current color is the marker one
else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
if (theAction == 'click') {
newColor = (thePointerColor != '')
? thePointerColor
: theDefaultColor;
marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
? true
: null;
}
} // end 4
// 5. Sets the new color...
if (newColor) {
var c = null;
// 5.1 ... with DOM compatible browsers except Opera
if (domDetect) {
for (c = 0; c < rowCellsCnt; c++) {
theCells[c].setAttribute('bgcolor', newColor, 0);
} // end for
}
// 5.2 ... with other browsers
else {
for (c = 0; c < rowCellsCnt; c++) {
theCells[c].style.backgroundColor = newColor;
}
}
} // end 5
return true;
} // end of the 'setPointer()' function