So I tried to google my problem, but for a change I didn't get any worthwhile answers. What I want to do is to have an external js file to define some functions (which will be used for form validation). Then I want to use the external functions inside each html to validate the particular forms (obviously forms on different pages will be different).

So what I had done:
Create blah.js
in blah.html:

<html>
<head>
<script language="javascript" src="blah.js"></script>
<script type="text/javascript">
  ...make function calls etc...
</script>
</head>
</html>

The above is not working for me. Is this even possible, and if so, do you know what is wrong? If you need actual code I have used, I shall post later.

Recommended Answers

All 2 Replies

That should work just fine. (And don't use language="javascript" anymore. Only use type="text/javascript").

Ok, thanks. Well I will play with it again later on, and see how it goes. Thanks for the re-assurance though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.