I created an html try.html file and js file func.js. every thing runs right, except it doesn't 'read' the following kind of functions:
the function in func.js is defined as follows:
the js file is declared in the head part:
I also tryed declaring the function in the js file this way:
can anyone help me anderstand why it doesn't work?
Code:
<input type = "text" id="firstName" value="first name" onkepress=nameCheck(event)"/>
Code:
function nameCheck(event){
var ascii = event.charCode? event.charCode:event.keyCode;
if ((ascii >= 48) && (ascii <= 57)){
alert("don't type a digit!");
event.returnValue = false;
}
}
Code:
<head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="tikun.js"></script> </head>
Code:
$('document').ready(function(){
function nameCheck(event){......}
});
Comment