|
|
|
| Web Hosting |
![]() ![]() |
Calling Of Functions Between Mulitple External Javascript Files, How do I use an external script to call a function from another script |
Apr 19 2006, 10:59 PM
Post
#1
|
|
|
S.P.A.M.S.W.A.T. Group: Members Posts: 814 Joined: 22-January 05 From: San Antonio, Texas (No, I'm not dumb. I just moved here...) Member No.: 2,284 |
I have a page that requires many Javascript functions. In order to make the coding easier to read and edit, I decided to seperate them into 3 Javascript files. Two files will each do a specific job. One file will have the shared functions that both other 2 files will need to use. They are all linked to a page using three <script> tags.
The difficult part is that after the page calls a function in one of the special code files, that Javascript file will need to call the functions located in the common Javascript file. The file will call several functions, and it will an argument with it each time. When I try to call the function as if it were on the same file, the script stops. I Googled for solutions (14 different queries and over 10 clicked results), but only a few sites had information relevant to my question. This page was the closest to helping me solve the problem. However, the page (and possibly server) no longer exists, and besides, the solution on the cached page didn't help me. |
|
|
|
Apr 20 2006, 05:41 AM
Post
#2
|
|
|
PESTICIDAL MANIAC Group: Members Posts: 630 Joined: 1-September 04 From: Auckland, New Zealand Member No.: 27 |
Can you shed some code examples, usually it just depends on the order in which you load the scripts. Also if the script performs an action that requires a function, that function must be known before it's called, the only way around that is calling the action when everything is loaded, or reordering your functions.
In that example shown, it shows that the function is loaded first and then the action to calling it is in the next file, you could not do this the other way around because that function would be undefined. Whatever you are doing, it sounds like you would be best using a class. Cheers, MC |
|
|
|
Apr 21 2006, 12:13 AM
Post
#3
|
|
|
S.P.A.M.S.W.A.T. Group: Members Posts: 814 Joined: 22-January 05 From: San Antonio, Texas (No, I'm not dumb. I just moved here...) Member No.: 2,284 |
After I made an example site in [acronym=HyperText Markup Language]HTML[/acronym], I rewrote it again and again and found that it did not have any problems. So, I consulted my [acronym=XML User Interface Language]XUL[/acronym] file (which is actually where I have the problem) and tried to fix the perfect page to make something go wrong. However, I could not. So I tried to adapt the [acronym=XML User Interface Language]XUL[/acronym] file into an [acronym=HyperText Markup Language]HTML[/acronym] file, and miraculously, the page worked. Now I know that this Javascript problem exists only in [acronym=XML User Interface Language]XUL[/acronym]. (By the way, if you still want to see my example site, it is here.)
Do you know why this happens in [acronym=XML User Interface Language]XUL[/acronym]? If you don't know, could you tell me about classes? |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
3 | saneax | 1,729 | Yesterday, 09:36 AM Last post by: zlatan24 |
|||
![]() |
7 | flute | 317 | 5th January 2009 - 04:07 AM Last post by: santaclaus |
|||
![]() |
23 | WeaponX | 7,065 | 2nd January 2009 - 09:48 AM Last post by: iG-jagadesh |
|||
![]() |
21 | RGF | 4,903 | 31st December 2008 - 07:22 PM Last post by: Guest |
|||
![]() |
6 | Orca239 | 865 | 31st December 2008 - 09:29 AM Last post by: mastercomputers |
|||
![]() |
5 | bridgebuilder | 1,678 | 23rd December 2008 - 06:47 PM Last post by: pyost |
|||
![]() |
1 | cherri | 1,358 | 21st December 2008 - 09:59 AM Last post by: iG-Christian |
|||
![]() |
15 | soleimanian | 7,900 | 13th December 2008 - 12:54 PM Last post by: tek3D |
|||
![]() |
11 | elevenmil | 4,777 | 10th December 2008 - 10:28 AM Last post by: iG-rakesh |
|||
![]() |
3 | rahid | 249 | 9th December 2008 - 09:22 PM Last post by: yordan |
|||
![]() |
1 | veerumits | 173 | 5th December 2008 - 09:16 PM Last post by: iG-James |
|||
![]() |
3 | netc0n | 2,529 | 3rd December 2008 - 07:52 AM Last post by: iG-suman |
|||
![]() |
7 | indwebdesphs | 1,322 | 1st December 2008 - 12:52 PM Last post by: iG-biju |
|||
![]() |
3 | veerumits | 142 | 30th November 2008 - 06:36 AM Last post by: Darasen |
|||
![]() |
4 | Vyoma | 223 | 28th November 2008 - 08:51 PM Last post by: yordan |
|||
|
Lo-Fi Version | Time is now: 9th January 2009 - 06:51 AM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Apr 19 2006, 10:59 PM





