JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 31st, 2004, 04:27 PM
shawn shawn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 24 shawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 31st, 2004, 05:52 PM
Jackot29 Jackot29 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Paris, FRANCE
Posts: 29 Jackot29 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 32 m 10 sec
Reputation Power: 0
Smile tags positionning is important, (relatively to the functions or variables calls)

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.

Reply With Quote
  #3  
Old August 31st, 2004, 06:04 PM
shawn shawn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 24 shawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by Jackot29
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.


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?

Reply With Quote
  #4  
Old August 31st, 2004, 06:11 PM
Jackot29 Jackot29 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Paris, FRANCE
Posts: 29 Jackot29 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 32 m 10 sec
Reputation Power: 0
Question

It seems to be good. Exposed like it, it should work.

Could you tell more about this 3 files ?

Reply With Quote
  #5  
Old September 1st, 2004, 11:19 AM
shawn shawn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 24 shawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > external js files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT