Is it possible in HTML to insert onclick=function() like this:
<input type=submit name=subm id=sub value=Submit onclick=js() />
After this submit button is pressed I want to call the function js() which is included in the script. This function makes a control if one of my input fields with tel id contains characters or not.After submitting the form nothing outputs. Can someone help with this code so it can output the message inside the js() function.
<script>
var a=getElementById(tel);
//tel is the id of a input field
function js(){
if((a.search(/[a-zA-Z]*/))!=-1){
document.writeln(Tel nr mustn't contain charachters);
}
else document.writeln(The tel number is Ok);
}
</script>