title: how to move the selected item in a list box into a text box?
body: <p>i want to move the selected item of a select tag (list box) into a text box after clicking a button. i am using the below code</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript"&gt;
              function copy()
              {
                  var sel = document.getElementById('lb').value;
                  document.getElementById('FileName').value = sel;
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form name="frm1" id="frm1"&gt;
              &lt;select id="lb" name="lb" size="5"&gt;
                      &lt;option value="abc.txt"&gt;abc.txt&lt;/option&gt;
                      &lt;option value="def.txt"&gt;def.txt&lt;/option&gt;
              &lt;/select&gt;
  
              &lt;input type="button" value="&gt;&gt;" name="btn_move" id="btn_move" onclick="copy()"&gt;
  
              &lt;input type="text" name="FileName" id="FileName"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the above code works properly in google chrome browser but it does not work when i run the page in IE. can anyone tell me whats the problem in the code and kindly suggest a javascript or any other code which is compatible ith both google chrome and IE.</p>
  
  <p>above code works after i allow the pop up that comes but
  actually the below code is not working.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;FILE&lt;/title&gt;
          &lt;style&gt;
              body{background-color:#b0c4de;}
              #OutBound{text-align:center;}
              #btn_sbmt{position:absolute;top:150px;left:700px;}
              #div_text_label{position:absolute;top:50px;left:200px;}
              #lbl2{position:absolute;top:80px;left:200px;}
              #selected_list{position:absolute;width:300px;top:80px;left:335px;}
              #btn_move{position:absolute;top:100px;left:650px;}
              #FileName{position:absolute;width:300px;top:100px;left:700px;}
          &lt;/style&gt;
          &lt;script type="text/javascript"&gt;
              function load_list()
              {
                  document.getElementById('div_main_select').style.display="none";
                  var textbox = document.getElementById('pattern');
                  var listbox = document.getElementById('selected_list');
                  var mainListbox = document.getElementById('lb');
                  listbox.innerHTML = '';
                  for (var childIndex = 0; childIndex &lt; mainListbox.children.length; childIndex++)
                  {
                      var child = mainListbox.children[childIndex];
                      option = document.createElement('option');
                      option.innerHTML = child.innerHTML;
                      listbox.appendChild(option);
                  }
                  alert (load_list_1);
              }
              function get_list()
              {
                  var textbox = document.getElementById('pattern');
                  var listbox = document.getElementById('selected_list');
                  var mainListbox = document.getElementById('lb');
                  listbox.innerHTML = '';
                  for (var childIndex = 0; childIndex &lt; mainListbox.children.length; childIndex++)
                  {
                      var child = mainListbox.children[childIndex];
                      if (child.innerHTML.search(textbox.value) != -1)
                      {
                          option = document.createElement('option');
                          option.innerHTML = child.innerHTML;
                          listbox.appendChild(option);
                      }
                  }
                  alert (get_list_1);
              }
              function copy()
              {
                  var sel = document.getElementById('selected_list').value;
                  document.getElementById('FileName').value = sel;
                  alert (copy_1);
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body style="color: black; background-color: rgb(255, 255, 255); background-image: url(background-1204x927.jpg);" BGCOLOR="#ffffff" text="black" link="#B03060" vlink="#B03060" onload="load_list()"&gt;
          &lt;hr&gt;
          &lt;form id="OutBound" name="OutBound" action="" method="GET"&gt;
              &lt;div style="text-align:center;" id="div_text_label" name="div_text_label"&gt;
                  &lt;label id="lbl1" name="lbl1"&gt;search :&lt;/label&gt;
                  &lt;input type="text" name="pattern" id="pattern" onKeyUp="get_list()"&gt;
              &lt;/div&gt;
              &lt;div style="text-align:center;" id="div_main_select" name="div_main_select"&gt;
                  &lt;select id="lb" name="lb" size="5"&gt;
                      &lt;option value="abc.txt"&gt;abc.txt&lt;/option&gt;
                      &lt;option value="def.txt"&gt;def.txt&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;label id="lbl2" name="lbl2"&gt;File List:&lt;/label&gt;
              &lt;select id="selected_list" name="selected_list" size="5"&gt;
              &lt;/select&gt;&lt;br&gt;
              &lt;input type="button" value="&gt;&gt;" name="btn_move" id="btn_move" onclick="copy()"&gt;
              &lt;input type="text" name="FileName" id="FileName"&gt;
              &lt;input type="submit" name="btn_sbmt" id="btn_sbmt" value="MOVE FILES"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the page works like this.. 
  1) there is a list box (lb) populated with some items. 
  2) there is 1 more empty list box (selected_list).
  3) when the page form is loaded load_list() function is called which loads the empty list   box (selected_list) with the contents of the original list box (lb). 
  4) when someone enters a word or a letter in the search text box then get_list() function is called which filters the files according to the words entered.
  5) when a filename is selected in the selected_list and >> button is pressed, the copy() function is called and the filename is copied to the FILENAME text box.</p>
  
  <p>but this all is not working in IE but it works in google chrome. can anyone fix the code so that it works with IE also.</p>