473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

external js&jquery file

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:

Expand|Select|Wrap|Line Numbers
  1. <input type = "text"  id="firstName" value="first name" onkepress=nameCheck(event)"/>
the function in func.js is defined as follows:

Expand|Select|Wrap|Line Numbers
  1. function nameCheck(event){
  2.     var ascii = event.charCode? event.charCode:event.keyCode;
  3.     if ((ascii >= 48) && (ascii <= 57)){
  4.         alert("don't type a digit!");
  5.         event.returnValue = false;
  6.     }
  7. }
the js file is declared in the head part:

Expand|Select|Wrap|Line Numbers
  1. <head> 
  2. <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
  3. <script type="text/javascript" src="tikun.js"></script>
  4. </head>
I also tryed declaring the function in the js file this way:

Expand|Select|Wrap|Line Numbers
  1. $('document').ready(function(){
  2. function nameCheck(event){......}
  3. });
can anyone help me anderstand why it doesn't work?
Mar 29 '10 #1
1 1290
Dormilich
8,658 Expert Mod 8TB
there should be errors listed in the error console.

at least I can say, that the last one wouldn’t work anyway.
Mar 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Amilcar | last post by:
Hi: I have a problem: I've a page that sends an encrypted password, using MD5, to a PHP file, which is able to compare such MD5 encrypted password with an encryption stored on a data base. But...
3
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I...
4
by: Mark Anderson | last post by:
Sorry if this is a rookie mistake... I've been through all the FAQs and the books I have but I can't see the mistake so I guess it's something simple <g> - I'm an occasional JS user. I've got...
4
by: Randy Webb | last post by:
In trying to validate a document as XHTML Strict, and using &lt; and &gt; to display < and >, I get this message from the validator: character "&" is the first character of a delimiter but occurred as...
5
by: Ken | last post by:
I want to write a js variable inside a function to a web page. test.js try_picture(); function try_picture() { var picture = '<tr><td colspan=2 align=right><font size=2>Picture...
2
by: Adam | last post by:
I have a scrollbar that runs at the top of my page, I have it in a external js file and call it in the head tags of the webpage code. can you one tell me how to get this code to work with other...
1
by: Zwyatt | last post by:
Apologies if this is in the wrong newsgroup -- couldn't find one for whidbey web dev. I am having a problem using .js file w/ whidbey. Currently I have a .js file referenced on every page in my...
3
by: Artek Siara | last post by:
hello, I want to connect to firebird database from JavaScript; I've heard that it is possible. Did somebody do it? -- regards Artur
1
by: lakilevi | last post by:
Hi! I have a problem in integration of script.aculo.us's scriptaculous.js with the http://www.javascripttoolbox.com/lib/objectposition/source/position.js file. I think the both file has a Position...
3
by: lakilevi | last post by:
Hi! I have a problem in integration of script.aculo.us's scriptaculous.js with the http://www.javascripttoolbox.com/lib/objectposition/source/position.js file. I think the both file has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.