javascript form reset function not working

Posted by daniel on Stack Overflow See other posts from Stack Overflow or by daniel
Published on 2011-01-05T00:50:32Z Indexed on 2011/01/05 0:53 UTC
Read the original article Hit count: 97

Filed under:
<form name="mysqlDetails"> 
            <label class="text">url:</label><input id="url" type="text" name="url"/><br/> 
            <label class="text">country:</label><input id="country" type="text" name="country"/><br/> 
            ...
            <input type="button" id="button" value="save" onclick="ajax.insert('mysqlDetails')"/> 
            <input type="reset" id="clear" value="clear"/> 
            <input type="checkbox" id="autoclear"/><label>autoclear</label> 
        </form> 

function autoclear(frm){
if(document.forms[frm].getElementById('autoclear').checked==true){
    document.forms[frm].reset();
    document.forms[frm].getElementById('autoclear').checked=true;
}
}

this.connect=function(frm){
    if (isFirefox() && firefoxVersion() >= 3) {
        httpReq.onload = check;
    } else {
        httpReq.onreadystatechange = check;
    }
    httpReq.open('GET',url(frm),false);
    httpReq.send(null);
    autoclear(frm);
    }    

js is located in external file. executing form reset with an non-external file function works fine. why?

© Stack Overflow or respective owner

Related posts about JavaScript