By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

Multiple scripts on same HTML page

P: n/a
I know I can have multiple scripts on one HTML page (at least I think I know
I can).

i.e.

<script language="Javascript" type="text/javascript"
src="../js/mainbutts.js"></script>
...html code...
...html code...
<script language="Javascript" type="text/javascript"
src="../js/extrabutts.js"></script>
But the function names within each script, must they be unique? In other
words both scripts have a function called "rollOver". Can that conflict?
Should I rename them unique?

Of course one might think, "Why doesn't this idiot try and see, rather than
bother to ask?" But in my multiple decades of programming I've only learned
one solid lesson: Just because it works one way, doesn't mean it's the
right way to do it!

Thanks ahead, as always.
Jul 4 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Daniel Kaplan wrote:
I know I can have multiple scripts on one HTML page (at least I think I know
I can).

i.e.

<script language="Javascript" type="text/javascript"
src="../js/mainbutts.js"></script>
...html code...
...html code...
<script language="Javascript" type="text/javascript"
src="../js/extrabutts.js"></script>
But the function names within each script, must they be unique? In other
words both scripts have a function called "rollOver". Can that conflict?
Should I rename them unique?
The latter function declaration will overwrite the former if both
declare a function of the same name.
Thus if you need both functions then you need different names.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 4 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.