Reply
Call External JS from Another External JS
Old 01-26-2008, 05:26 PM Call External JS from Another External JS
Junior Talker

Posts: 4
Name: John
I have the following in one external js file. Its purpose is to implement dropdown menus.

function header() {
document.write('.....
<a href="javascript:void(0);" onClick="return clickreturnvalue();" onMouseover="dropdownmenu(this, event, menu3, 160px);" onMouseout="delayhidemenu();">PRODUCT INFO</a>.....')
}

The dropdownmenu, clickreturnvalue and delayhidemenu scripts are in another external file.

When the html portion of this code is in the html file directly, it works perfectly. Within the html file is the following head entry which gives the path to the external script:

<script type="text/javascript" src="support-files/dropdown.js"></script>

When I move the html for the dropdown scripts into an external js file wrapped in a document.write, the drop downs stop working.

Any thoughts?

Thanks.

Last edited by masscraft : 01-26-2008 at 05:28 PM.
masscraft is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-26-2008, 05:28 PM Re: Call External JS from Another External JS
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Have you tried switching the order of your JS files? Because a function in one JS file can be called from a function in 2nd...at least if the 2nd is 2nd in the code as well. I haven't tried it the other way around.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 01-27-2008, 01:28 AM Re: Call External JS from Another External JS
carloncho's Avatar
Skilled Talker

Posts: 80
Name: Carlos
1) Maybe the ADAMīs solution fix your problem.
2) Some day, i have similar problem. But the problem was the name of esternal file. I test files in a windows server, but upload to a linuz server, and the problem was the upper case letters in path: From that day, i put all names in lower case
__________________
-----------------------
http://www.xumby.com
carloncho is offline
Reply With Quote
View Public Profile Visit carloncho's homepage!
 
Old 01-27-2008, 02:48 PM Re: Call External JS from Another External JS
Junior Talker

Posts: 4
Name: John
Quote:
Originally Posted by carloncho View Post
1) Maybe the ADAMīs solution fix your problem.
2) Some day, i have similar problem. But the problem was the name of esternal file. I test files in a windows server, but upload to a linuz server, and the problem was the upper case letters in path: From that day, i put all names in lower case
Figured it out...the variables inside the () needed to be enclosed by apostrophes. For instance:

onMouseover="dropdownmenu(\'this\', \'event\', \'menu3\', \'160px\');"

versus

onMouseover="dropdownmenu(this, event, menu3, 160px);"

Works perfectly. Thanks for the suggestions.
masscraft is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Call External JS from Another External JS
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11949 seconds with 12 queries