I am attempting to nest a div tag inside another div tag using javascript. I am loading content from one page into a div tag and need the div tag to load the page as well as trigger the script when a user clicks on a menu image.
Javascript Code:
$('#menu-body a').click(function() {
var page = $(this).attr('href');
$('#body-wrap').load('content/' + page + '.php');
return false;
});
HTML Code:
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" >
<title>End of Us - Home</title>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>
<body onLoad="MM_preloadImages('img/home_over.png','img/store_over.png','img/support_over.png','img/forum_over.png')">
<div class="page-wrap">
<div class="menu-wrap">
<div class="menu-box"><a href="index" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','img/home_over.png',1)"><img src="img/home.png" width="134" height="65" id="home"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('store','','img/store_over.png',0)"><img src="img/store.png" width="144" height="65" id="store"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('support','','img/support_over.png',1)"><img src="img/support.png" width="190" height="65" id="support"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('forums','','img/forum_over.png',1)"><img src="img/forum.png" width="142" height="65" id="forums"></a></div>
</div>
<div class="body-wrap"></div>
<div class="footer-wrap">
<div class="footer-box">End of Us - Site by Gawdzahh</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/contentLoader.js"></script>
</body>