I need to fix this javascript error I am having "missing name after . operator on variable". This is my current code I am trying to get working.
<!DOCTYPE html>
<html>
<body onload="myFunction()">
<select>
<option>1</option>
</select>
<br/>
<select>
<option>1</option>
</select>
<script>
function myFunction()
{
if(typeof document.body.ontouchstart == "undefined"){actionIn = "onmouseover"; actionOut = "onmouseout"}
else{actionIn = "ontouchstart"; actionOut = "ontouchend";}
var elem = document.getElementsByTagName("SELECT");
for (var i = 0;i < elem.length; i++){
elem[i].[actionIn] = function(){this.style.background='red';}
elem[i].[actionOut] = function(){this.style.background='';}
}
}
</script>
</body>
</html>
elem[i].[actionIn]