Javascript on Mozilla? working on IE.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #16
    yes ... but what do you expect and what doesn't work?

    as far as i can see in the code there is a problem with the empty-check ...

    [CODE=javascript]
    function checkfname() {
    var upload_frm = document.getEle mentById('uploa d_frm');
    var len = upload_frm.elem ents.length;

    for(var g = 0; g < len; g++) {
    if(upload_frm.e lements[g].type == 'file') {
    if(upload_frm.e lements[g].value != "") {
    var n = upload_frm.elem ents[g].name;
    var num = n.substr(8);
    var fname = document.getEle mentById('fname '+num).value;

    if(fname == "") {
    alert("Please fill in a filename for each files selected.");
    return false;
    }

    if(fname.indexO f("\/") > -1) {
    alert("The '/' character is not allowed in the filename.");
    return false;
    }
    }
    }
    }
    return true;
    }
    [/CODE]

    you test :: upload_frm.elem ents[g].value != "" at first and so i think fname == "" will never come true until you compare the same field-values? ;)

    kind regards ...

    Comment

    Working...