title: Using document.getElementById() in IE 9 and previous versions
body: <p>I have a web page that is used to upload a file.  There are two input fields on the form.  One is of type text used to give the file a name in our database.  The other is of type file to select the file to upload.</p>
  
  <pre><code>&lt;input type="text" name="docName" id="docName" size="35" value="" /&gt;
  &lt;input type="file" name="importFile" id="importFile" size="35" onchange="refreshFileName();"/&gt;
  </code></pre>
  
  <p>I want to use JavaScript to extract the actual file name (minus the file path) from the "importFile" field once it's selected and auto-populate the field "docName" with that value.  My JavaScript looks like this:</p>
  
  <pre><code>function refreshFileName(){
  var fileName = document.getElementById('importFile').value; 
  
  var str = fileName.split("\\");
  var length = str.length;
  
  document.getElementById('docName').value = str[length-1]; 
  }
  </code></pre>
  
  <p>This seems to work just file in Chrome, Firefox and IE 10 or 11.  But it doesn't seem to work in IE 9 or earlier versions.  Nothing I have tried seems to solve the problems.  Any suggestions on how I can get this to work with earlier version of IE (I've already thought of the idea "just tell my users not to use IE").  </p>