There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
black screen blue screen boot bsod computer connection crash css dell display driver drivers email error explorer firefox firefox 3 hard drive internet internet explorer itunes laptop lcd malware monitor network networking nvidia outlook outlook 2003 outlook express password printer problem problems ram router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Having Two External ".JS" Files With "OnLoad"


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
BarraGT's Avatar
Senior Member with 298 posts.
 
Join Date: Jun 2005
Location: Canberra, Australia
Experience: Intermediate
02-Oct-2005, 01:26 AM #1
Arrow Solved: Having Two External ".JS" Files With "OnLoad"
I have two external JavaScript files that both have the "OnLoad" command with them. I need to source both files in one web-page. How can I make them work together?

I know there is a way to do it if they are used internally, within the web-page, but these are external.

Thanks!
php guy's Avatar
Computer Specs
Senior Member with 514 posts.
 
Join Date: Dec 2004
Location: Bowlaro Lanes, WA
Experience: That's Mr. Clueless to you
02-Oct-2005, 04:50 PM #2
External .JS files are treated the same way as internal js, so if you have two functions, say function1 in script1.js and function2 in script2.js, and you wanted them to be handled with onLoad, then first you have to call both .JS files in <head>...
HTML Code:
<head> <script type="text/javascript" src="script1.js"> <script type="text/javascript" src="script2.js"> </head>
then in you're body tag, you write it as...
Code:
<body onLoad="function1(); function2();">
Hope this gets what you wanted
__________________
if($post) echo $signature;
BarraGT's Avatar
Senior Member with 298 posts.
 
Join Date: Jun 2005
Location: Canberra, Australia
Experience: Intermediate
02-Oct-2005, 10:24 PM #3
Quote:
Originally Posted by php guy
External .JS files are treated the same way as internal js, so if you have two functions, say function1 in script1.js and function2 in script2.js, and you wanted them to be handled with onLoad, then first you have to call both .JS files in <head>...
HTML Code:
<head> <script type="text/javascript" src="script1.js"> <script type="text/javascript" src="script2.js"> </head>
then in you're body tag, you write it as...
Code:
<body onLoad="function1(); function2();">
Hope this gets what you wanted
That did the trick. Thanks for that!
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
02-Oct-2005, 10:27 PM #4
You can mark this Solved under "Thread Tools."
BarraGT's Avatar
Senior Member with 298 posts.
 
Join Date: Jun 2005
Location: Canberra, Australia
Experience: Intermediate
02-Oct-2005, 10:28 PM #5
Done!
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:08 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.