views:

68

answers:

2

I have a JavaScript file contains various string functions. It is a separate .js file. I also have a .css file that defines the styles of Input Boxes. Some styles are executed on certain events like: focus etc.

I want to call the string functions in the .js file on Input Box events. I want to know:

(1) Whether to call the functions from within CSS file, since that file is also handling styles for certain events?

(2) If I use in-line, how to access the function that resides in the .js file?

+2  A: 

1) You can´t call JavaScript from a true text/css resource.

2) Don´t use inline calls. Use unobtrusive javascript.

anddoutoi
+2  A: 
  1. Only ie supports so called behaviours in css. So generaly speaking, it's not possible.
  2. Functions inside other .js files just live in the global namespace. You can just call them by their name.
Ikke