Dear All Experts

I wrote a simple code in javascript and it is working fine with IE and Firefox but the out put in php array count is correct in IE but not correct in Firefox

Please check the code attached here.

<script language="javascript">

 var arrdimensions = {
    "codimesion":{"s":{'0':'dimesion1','1':'dimesion2','2':'dimesion3','3':'dimesion4','4':'dimesion5','5':'dimesion6','6':'dimesion7'},"c":1,"m":"50", "sc":1, "f":"nopcs[]"}
function adddimensions(what) {
    parentId = gbi(what);
    var count = 0;
    for (idx in arrdimensions[what]['s']) {
     var trElem = document.createElement('tr');
     var contentId;
     var txt = new Array();
    for (var i=0; i<count; i++) {
        var tdElem = document.createElement('td');
        tdElem.innerHTML = gbi(arrdimensions[what]['s'][i]).innerHTML;
       var f = document.getElementsByName(arrdimensions[what]["f"]);
        f[arrdimensions[what]["c"] + arrdimensions[what]["sc"]].focus();
      // f[arrdimensions[what]["c"]+arrdimensions[what]["sc"]].focus();
       arrdimensions[what]["c"] += arrdimensions[what]["sc"];
     return true;
function gbi(layerid) {
    return document.getElementById(layerid);


I would suspect document.getElementsByName() . I confess I've never used it and as far as I can recall, it doesn't get a mention in my DOM reference book (I'm currently away from home), and though it is in a W3C recommendation, I can't get it to work (not even in IE), though I may be doing something wrong.

See if you can find a way to achieve what you want without using document.getElementsByName() .