That's really two questions, and the second one is off topic. Let's try and deal with the first one:
I'm sorry, but can you visually elaborate on what you're talking about?
The short answer is no because what belongs in that file depends upon what's in the files it's being included in and where in those files it's being included, and upon the path(s) those files are in.
For example, if these files already have a DOCTYPE declaration, an opening html tag and a head section, then these do not belong in the include.
If these files are in various paths, the absolute paths to the scripts should be used in the include.
Browsers will often error correct for you (the markup of, never the paths to files). If you want the resulting pages to be standards compliant (or at least to avoid errors that some browsers might not error correct for you), you need to look at the code of the resulting pages. In them there should be only one each of certain tags. I'm sure you know about this, at least in regards to a normal page.
What you can do to check is to view the resulting page(s) in the browser and use it's 'view source' to see the source code that is being served.
You can also validate the resulting page(s) at the w3c.org validator:
http://validator.w3.org/
That much said, you can use the scripts as you have them as long as they work. As I said before though:
That's no more than would be on an average page anyway. So it's OK. If you wanted to, you could put the script code (not the script tags) in an external script, that would represent some savings when loading each page.
I can visually represent that part, get rid of the highlighted:
Code:
<script type="text/javascript" src="./js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="./js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./js/html5.js"></script>
<script type="text/javascript" src="./js/modernizr-1.5.js"></script>
<script type="text/javascript" src="./js/coin-slider.js"></script>
<script type="text/javascript" src="./js/coin-slider.min.js"></script>
<script type="text/javascript" src="./nav/js/ddaccordion.js">
/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript">
ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "200", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
jQuery(function($){ //on document.ready
var $targets=$('h3.menuheader')
$targets.mouseenter(function(){
$(this).addClass('overheader')
})
$targets.mouseleave(function(){
$(this).removeClass('overheader')
})
})
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#coin-slider').coinslider({ width: 770, height: 540, spw: 7, sph: 5, delay: 3000, sDelay: 30, opacity: 0.7, titleSpeed: 500, effect: 'rain', navigation: false, links : false, hoverPause: false });
});
</script>
The first because it's a duplicate of the script that follows it. The rest because of the reason I stated:
you don't want to put scripting on the required page. It will have to be parsed by the browser each time any page that requires it is loaded.
Now, of course you presumably still need that code. It could all go in an external file - say myscripts.js - put it in the js folder. The contents of myscripts.js would be (assuming it's all working the way you have it in your last post):
Code:
ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "200", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
jQuery(function($){ //on document.ready
var $targets=$('h3.menuheader')
$targets.mouseenter(function(){
$(this).addClass('overheader')
})
$targets.mouseleave(function(){
$(this).removeClass('overheader')
})
})
$(document).ready(function() {
$('#coin-slider').coinslider({ width: 770, height: 540, spw: 7, sph: 5, delay: 3000, sDelay: 30, opacity: 0.7, titleSpeed: 500, effect: 'rain', navigation: false, links : false, hoverPause: false });
});
And then your include file could (assuming you don't need all those other tags for the DOCTYPE html and head) look like so:
Code:
<script type="text/javascript" src="./js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./js/html5.js"></script>
<script type="text/javascript" src="./js/modernizr-1.5.js"></script>
<script type="text/javascript" src="./js/coin-slider.js"></script>
<script type="text/javascript" src="./js/coin-slider.min.js"></script>
<script type="text/javascript" src="./nav/js/ddaccordion.js">
/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript" src="./js/myscripts.js"></script>
But, as I say, you may need to use the absolute paths to these scripts if the pages that use them aren't all in the same folder. The bottom line on that is that the paths must be correct for all the pages that import this include.
As for your other question, I think it would be best if you opened a new thread for that.
However, it's always a good idea when installing a new script to at first try to get it working in a local mock up without using any includes.
Bookmarks