|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
external js files
Howdy yall.
I am having a little trouble here with external js files. I have a page which loads a .js file with my navigation scripts. I also have another .js file that I would like to load which contains all the specific page functions. However, it doesn't seem to like that I have two external files. One works just fine. If I copy and paste the code from the second one into the html file, it works. It just complains when I have two external js. Is there a one external file limit? Heres the code if that helps any. Code:
<script language="JavaScript" src="partfilenavigation.js"></script> <script language="JavaScript" src="partfilerouting.js"></script> The above doesnt work. The below does. The code is the partfilerouting.js file is what is inside the script tags in the inline javascript. Code:
<script language="Javascript" src="partfilenavigation.js"></script>
<script>
function doThis() {
alert("Test");
}
</script>
Any reason why? Thanks in advance for any help. Shawn |
|
#2
|
|||
|
|||
|
If you call the doThis() function, you must insert the Script-Insert-Tag before it in your page.
However, the doThis() function can be declared anywhere, if you insert it directly in your page. There is no other restriction. You can load as many external .js files as needed. |
|
#3
|
|||
|
|||
|
Quote:
I do call the doThis() function. I use the functions as my onBlur="doThis();" events and such. My two externals are declared right after each other. Neither external refers to each other. The externals are declared in the HEAD section of the HTML page. Does that make any sense? |
|
#4
|
|||
|
|||
|
It seems to be good. Exposed like it, it should work.
Could you tell more about this 3 files ? |
|
#5
|
|||
|
|||
|
Possible answer
Ok, I think I may have figured out what makes it not work. I probably failed to mention (not thinking it should matter) that I am
programming in Coldfusion. Well, the javascript interacts with the Coldfusion varaibles using CFOUTPUT tags to identify those varaibles. Apparently, javascript can handle this when the function is inline, but not when it is external. I tried a simple function that just sent an alert to the screen, and it worked fine. But when I tried to have it alert with the coldfusion variable it threw an error upon loading the javascript. So that seems to be the problem. Thanks for the assistance anyway. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > external js files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|