Hello, I am a newbie for JS. I am unable to use two javascripts on a single page. Can someone help me as its not working perfectly?
Below is my HTML Code....

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>HTML Frames Example - Content</title>
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/slideshow.js"></script>
<style type="text/css">
body {
	font-family:verdana,arial,sans-serif;
	font-size:10pt;
	margin:1px;
	background-color:#F2FeFe;
	}
h2
{
color:#484848;
font-size:18px;
text-align:Left;
text-decoration:underline;
}
p
{
font-family:verdana,arial,sans-serif;
font-size:12px;
text-align:Left;
color:#000000;
}
#imgbar
{
text-align=center;
}
div
{
text-indent:0px;
padding:0px;
text-align=justify;
}
.text
{
text-shadow: 0 0 10px #c61a1a;
font-size:50px;
color:#c61a1a;
}
div.slideshow {
			margin: 1px auto;
}
</style>
<base target="_self">
</head>
<body style="background-color: #EFEFEF">

		<div align=justify>
		<div style="position: absolute; width: 878px; height: 237px; z-index: 3; left: 5px; top: 8px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; background-color:#FFFFFF; visibility:visible" id="layer1">
			<h2>Introduction</h2>
			<p>This is first paragraph.Phasellus suscipit, leo a pharetra 
			condimentum, lorem tellus eleifend magna, eget fringilla velit magna 
			id neque. Curabitur vel urna. In tristique orci porttitor ipsum. 
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec 
			libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac 
			convallis aliquam.Phasellus suscipit, leo a pharetra condimentum, 
			lorem tellus eleifend magna, eget fringilla velit magna id neque. 
			Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum 
			dolor sit amet, consectetuer adipiscing elit. Donec libero. 
			Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac 
			convallis aliquam.Phasellus suscipit, leo a pharetra condimentum, 
			lorem tellus eleifend magna, eget fringilla velit magna id neque. 
			Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum 
			dolor sit amet, consectetuer adipiscing elit. Donec libero. 
			Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac 
			convallis Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
			Donec libero. Suspendisse bibendum. Cras id urna Lorem ipsum dolor 
			sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse 
			bibendum. Cras id urnaLorem ipsum dolor sit amet, consectetuer 
			adipiscing elit. Donec libero. Suspendisse bibendum. Cras id 
			urnaLorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec 
			libero. Suspendisse bibendum. Cras id 
			</div>
		<div align=justify>
		<div style="position: absolute; width: 878px; height: 158px; z-index: 4; left: 5px; top: 420px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; background-color:#FFFFFF; visibility:visible" id="layer3">
			<h2>About Us</h2>
			<p>This is first paragraph.Phasellus suscipit, leo a pharetra 
			condimentum, lorem tellus eleifend magna, eget fringilla velit magna 
			id neque. Curabitur vel urna. In tristique orci porttitor ipsum. 
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec 
			libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac 
			convallis aliquam.Phasellus suscipit, leo a pharetra condimentum, 
			lorem tellus eleifend magna, eget fringilla velit magna id neque. 
			Curabitur vel urna. In tristique orci porttitoorem ipsum dolor sit 
			amet, consectetuer adipiscing elit. Donec libero. Suspendisse 
			bibendum. Cras id urnaLorem ipsum dolor sit amet, consectetuer 
			adipiscing elit. Donec libero. Suspendisse bibendum. Cras id 
			urnaLorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec 
			libero. Suspendisse bibendum. Cras id </div>
		<div style="position: absolute; width: 878px; height: 158px; z-index: 5; left: 5px; top: 253px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; background-color:#FFFFFF; visibility:visible" id="layer2">
			<h2>Vision Statement</h2>
			<p>This is first paragraph.Phasellus suscipit, leo a pharetra 
			condimentum, lorem tellus eleifend magna, eget fringilla velit magna 
			id neque. Curabitur vel urna. In tristique orci porttitor ipsum. 
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec 
			libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac 
			convallis aliquam.Phasellus suscipit, leo a pharetra condimentum, 
			lorem tellus eleifend magna, eget fringilla velit magna id neque. 
			Curabitur vel urna. In tristique orci porttitor ipsum. Lorem ipsum 
			dolor sit amet, cSuspendisse bibendum. Cras id urna Lorem ipsum 
			dolor sit amet, consectetuer adipiscing elit. Donec libero. 
			Suspendisse bibendum. Cras id urnaLorem ipsum dolor sit amet, 
			consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. 
			Cras id urnaLorem ipsum dolor sit amet, consectetuer adipiscing 
			elit. Donec libero. Suspendisse bibendum. Cras id </div>
		<div style="padding:0px; position: absolute; width: 360px; height: 217px; z-index: 6; left: 894px; top: 420px; visibility:visible" id="layer8">
<div style="position: relative; width: 360px; height: 18px; z-index: 2; left: 0px; top: 0px;background-color:#6c6c6c" id="layer5">
		<p style="text-align: center"><b><font color="#FFFFFF" size="3">Hall of 
		Fame</font></b></div>
			<div class="slideshow" id="slideshow"> 
		<img src="images/4.jpg" alt="Pensions Hall of Fame" height="100%" width="100%"> 
	</div> 
 
	<script type="text/javascript"> 
		myShow = new Slideshow('slideshow', { type: 'combo', duration: [2000, 3000], width: 360, height: 217, images: ['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg','8.jpg'], hu: 'images/' });		
	</script>

		</div>
		</div>
				
	<div style="padding:0px; position: absolute; width: 360px; height: 167px; z-index: 2; left: 894px; top: 8px; visibility:visible; background-color:#FFFFFF" id="layer4">
			<div style="position: relative; width: 360px; height: 18px; z-index: 2; left: 0px; top: 0px;background-color:#6c6c6c" id="layer5">
		<p style="text-align: center"><b><font color="#FFFFFF" size="3">Leader 
		Speaks</font></b></div><p>
			<img border="0" src="23151_682656179_8233_n.jpg" width="104" height="121" align="left"><b>V</b>ivek 
			Kaul joined Life &amp; Pensions process in July 2011 as an Associate 
			Vice President. A result oriented professional studied from Usmania 
			University, Hyderabad ha 10 years of professional experience in 
			Operations &amp; People Management. ............................. 
			............... ........... ..........................(Read more).</p></div>
		<div style="padding:0px; position: absolute; width: 360px; height: 217px; z-index: 1; left: 894px; top: 181px; visibility:visible; background-color:#FFFFFF" id="layer6">
			<div style="position: relative; width: 360px; height: 18px; z-index: 2; left: 0px; top: 0px;background-color:#6c6c6c" id="layer7">
<p style="text-align: center"><b><font size="3" color="#FFFFFF">Communications</font></b></div>

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//specify path to your external page:
var iframesrc="external.htm"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="100%" height="100%" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>')

</script>

</div>

</body>
</html>

There's nothing to stop you having two or more script tags lined up on the page like that. I have seen pages with ten or more.

You typically have to ensure that scripts are loaded in the right order. For example, there's no point loading a script that uses mootools before mootools itself is loaded. You'll just get an error.

Be aware that all scripts occupy the same global namespace (the "window" namespace, which incongruously has the same life as the document, not the window). Hence, any named member created in the global namespace will be overwritten by a member of the same name created in a script loaded afterwards. For this reason it is good practice to write scripts that create a maximum of ONE global member. It is normally possible to create complex functionality with precisely ZERO global members.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.