logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Spry
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-19-2012, 10:04 PM   #1
MikeyRitz
 
Join Date: Nov 2012
Posts: 15
Default 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.
MikeyRitz is offline   Reply With Quote
Old 11-20-2012, 01:52 PM   #2
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

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.
__________________
www.gentlemedia.nl
gentleone is offline   Reply With Quote
Old 11-20-2012, 08:45 PM   #3
MikeyRitz
 
Join Date: Nov 2012
Posts: 15
Default

Thanks for taking the time to reply gentleone. Very much appreciated.
MikeyRitz is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:06 PM.


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