Dreamweaver Club Forums

Dreamweaver Club Forums (http://www.dreamweaverclub.com/forum//index.php)
-   Spry (http://www.dreamweaverclub.com/forum//forumdisplay.php?f=189)
-   -   Spry Menu Not Displaying External Javascripts (http://www.dreamweaverclub.com/forum//showthread.php?t=43863)

MikeyRitz 11-19-2012 10:04 PM

Spry Menu Not Displaying External Javascripts
 
Hi all,

Sorry for sounding daft, but I'm pretty new to coding.

I wish to place the few javascript functions that I use on my website into one external file. I've read this is better practice as I initially placed them all on each webpage.

The external javascript file looks like this:

<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20927289-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript" src="jquery.magnifier.js">

/***********************************************
* jQuery Image Magnify- (c) 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 this script and 100s more
***********************************************/

</script>

<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>

<!-- Begin Web-Stat code 2.0 http -->
<script type="text/javascript" src="http://server4.web-stat.com/wtslog.pl?al230354,3"></script>
<noscript></noscript>
<!-- End Web-Stat code v 2.0 -->


I just cut and pasted each snippet of javascript out of the page and placed it in a separate file which I named javascript.js

As you can imagine, there are syntax errors flying up with the code.

I placed this snippet on the main webpage in order to link to the external js code:

<script type="text/javascript" src="javascript.js"></script>

The spry drop down menus ceased working so for now I have pasted the two relevant spry scripts back on to the page.

Ultimately, I wish to have all the scripts on their own external page.

My website is www.itsamodthing.com

Any help would be greatly appreciated by this newbie.

gentleone 11-20-2012 01:52 PM

If you combine javascript files, then you must not include <script type="text/javascript" src="somejavascriptfile.js"></script> tags in your combined file. Just copy only the content of those files and paste that in your combined file.

MikeyRitz 11-20-2012 08:45 PM

Thanks for taking the time to reply gentleone. Very much appreciated.


All times are GMT. The time now is 06:30 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com