JavaScript work at IE but not working at Chrome

39 Views Asked by At

I'm trying to submit the form by using this function. This function work at IE, but does not work at Chrome. Variable idx is number e.g '15'.

As far as I know, IE and Chrome have different logic at running js files, does this error because of this reason?

     function setValue(idx) {   
     var sidArr = document.getElementsByName("sid");
     document.getElementById("SITE_ID").value = sidArr(idx).value;  
     fm.submit();}

Error Msg at Chrome debuger:

test.servlet.student.studentSiteSearch:48713 Uncaught TypeError: sidArr is not a function

Edit

<form name="fm" method="post" action="<%=contextPath%>/servlet/test.servlet.student.studentSiteSearch2">
    <table>
        <tr>            
            <input id="SITE_ID" name="SITE_ID" type="hidden">
            <input name="formAction" type="hidden" value="<%=action%>">
        </tr>
    </table>
    <p> 
        <input type="button" name="Button" value="Back" onclick='prev_page()'>
        <input name="CRT_USER" type="hidden" value="<%=user.getUser_id()%>">    
    </p>
</form>
0

There are 0 best solutions below