0

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']) {
       count++;
    }
     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;
        trElem.appendChild(tdElem);
    }
     parentId.appendChild(trElem);
       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);
}
</script>

Edited by Reverend Jim: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Airshow
0

Jagadeshms,

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() .

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.