get error nil class on search form code example

Example 1: how to call javascript method using selectlist on change in vf page

var e = document.getElementsByClassName("chartBlock")[0];
    var strUser = e.options[e.selectedIndex].value;
 var visualization = new google.visualization.LineChart(strUser);

Example 2: how to call javascript method using selectlist on change in vf page

<apex:selectList size="1" styleclass="chartBlock">
      <apex:selectOptions value="{!dynamiclist}"></apex:selectOptions>
 </apex:selectList>