Html page not reading external javascript -
having trouble connecting external javascript html page. pretty sure have saved file script.js in correct folder , path correct has not worked. not sure why. pretty sure have correct coding when paste on html page nothing seems work either when run it. not alerts pop when suppose i.e numbers postcode or must have @ in email etc. might javascript im not sure new this.
here external javascript:
function validateform() { if (document.getelementbyid("name").value == "") { alert("you cannot leave field blank. please enter name"); } else { alert("field ok"); } if (document.getelementbyid("address").value == "") { alert("please enter address"); document.getelementbyid("address").focus(); return false; } if (isnan(document.getelementbyid("postcode").value.length < 4)) { alert("your postcode not valid"); } else { alert("you have entered postcode correctly"); } if (document.getelementbyid("email").value.length < 5 || document.getelementbyid("email").value.indexof("@") == -1) { alert("please enter email min 5 chars , include @ symbol"); document.getelementbyid("email").focus(); return false; } { if (isnan(document.getelementbyid("creditcard").value.length < 16)) { alert("please enter creditcard number"); } else { alert("please enter valid credtcard number"); } alert("thank submission!"); return true; }
i think, there's 1 bracket much.
{ // <---- remove this. if (isnan(document.getelementbyid ("creditcard").value.length < 16))
Comments
Post a Comment