javascript function not working in IE 7

Posted by JPro on Stack Overflow See other posts from Stack Overflow or by JPro
Published on 2010-04-09T11:01:43Z Indexed on 2010/04/09 11:03 UTC
Read the original article Hit count: 374

Filed under:
|

Hi,

Can anyone please tell me how do I make this script run in IE 7? When I run this , nothing happens.

<html>
<body>
<script language="JavaScript">
function moveSelectedOption() {
    // Fetch references to the <select> elements.
    var origin = document.getElementById('origin_select');
    var target = document.getElementById('target_select');


    // Fetch the selected option and clone it.
    var option = origin.options[origin.selectedIndex];

   var copy = option.cloneNode(true);

    // Add the clone to the target element.
    target.add(copy, null);
}
</script>
<select id="origin_select" multiple>
    <option value="A">A</option>
    <option value="B">B</option>
    <option value="C">C</option>
</select>
<select id="target_select" multiple>

    <option value="C1">C1</option>
</select>
<button onclick="moveSelectedOption()">Add</button>

</body>
</html>

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript