Click to See Complete Forum and Search --> : call?
DanUK
07-14-2003, 06:53 PM
Hello.
Instead of having masses of code for Javascript, which makes the 'view source' so big, is there a way to simply put something in teh code so it calls on a file, i.e. validate.js, instead of having the actual script in the source?
thanks if you can help!
Khalid Ali
07-14-2003, 07:05 PM
put all of your javascript code in a file and save it as
whatever.js
then in the head section of your page put this lineof code
<script src="whatever.js" type="text/javascript"></script>
DanUK
07-14-2003, 07:40 PM
ahhh ok, brilliant. But do i need to put anything for the function? for example, if my validation was the function 'checkthis' do i need to put that anywhere to make sure it reads the .js file on 'submit'?
brendandonhue
07-14-2003, 08:49 PM
Nope-call your functions as you normally would.
DanUK
07-14-2003, 09:05 PM
ok great, so all i really need to do is just put the actual scripts in some .js files and put that in head, i dont need to change any of the other code that calls on those scripts?
thanks again!
brendandonhue
07-14-2003, 09:07 PM
Correct.
DanUK
07-14-2003, 09:13 PM
okay lovely. i'll get on with that now.
Does this type of action actually 'speed' up the load time, or delay it, or is there no difference except the actual source becomes 'smaller'?
:D