We have a client website where dropdowns stop working.
Google Console shows the following:
Uncaught TypeError: Cannot read properties of null (reading 'style')
at OpenListBox (Location_Edit.aspx?lid=11502:47)
at HTMLSpanElement.onclick (Location_Edit.aspx?lid=11502:623)
Code for this section is as follows: ** is line 623 where error is noted.
<div>
<table id="canvas_multiSelectDropDown1_Table2"
style="TABLE-LAYOUT: fixed; HEIGHT: 24px"
borderColorDark="#cccccc" borderColorLight="#7eb3e3"
cellspacing="0" cellpadding="0" width="100%"
border="1">
<tr id="canvas_multiSelectDropDown1_rowDD" ** style="HEIGHT: 15px">
<TD nowrap="nowrap">
<span id="canvas_multiSelectDropDown1_DDLabel" onclick="OpenListBox('ctl00_canvas_multiSelectDropDown1_');" style="display:inline-block;border-color:Transparent;border-style:None;font-family:Arial;font-size:Smaller;height:15px;width:250px;CURSOR: default">VSP - Xerox Phaser 6600 (Black)</span></TD>**
<TD id="canvas_multiSelectDropDown1_colDDImage" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #7eb3e3" width="20" background="images/DDImage.bmp" onclick="OpenListBox('ctl00_canvas_multiSelectDropDown1_');"></TD>
</tr>
</table>
Looking further I ....is it possible error is in the set of code: OpenListBox
function OpenListBox(ctlId) {
var lstBox = document.getElementById(ctlId + "DDList");
if (lstBox.style.visibility == "visible")
{ CloseListBox(ctlId); }
else {
lstBox.style.visibility = "visible";
lstBox.style.height = "120px";
}
}
_________________-
Issue solved: This was a recently migrated website- after migrating I noticed: Current verison iss Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3905.0
The solution was to roll back to Microsoft .NET Framework version 2.0