View Full Version : Dynamic Content not working

10-12-2010, 11:13 AM
1) Script Title: Dynamic Content not working

2) Script URL (on DD): on internal server

3) Describe problem: I want to only load the content of the pages when going to a page i dont want to load header and menus every tine. I have gone through your tutorial on dynamic content but it wont work for me i dont know what i have done workg can soneone see where i am going wrong. Thanks for help in advance.
Code is here for two files


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<title>Welcome to the Beacon Hospital</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />

<script language="JavaScript" src="/tools/BeaconMenu/menu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<link rel="stylesheet" href="/tools/BeaconMenu/menu.css">
<script type="text/javascript">

* Dynamic Ajax Content- 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

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
catch (e){
page_request = new ActiveXObject("Microsoft.XMLHTTP")
catch (e){}
return false
loadpage(page_request, containerid)
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))

function loadobjs(){
if (!document.getElementById)
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref.setAttribute("src", file);
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
if (fileref!=""){
loadedobjects+=file+" " //Remember this object as being already added to page

var menuids=["suckertree1"]

function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
else //else if this is a sub level submenu (ul)
ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars

if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)


<div class="row1">
<div class="container">
<div class="col1">
<img src="images/beacon_logo_intro3.jpg" style="width: 229px; height: 52px" />
<div class="col2 left">

<script type="text/javascript" language="JavaScript">
new menu (MENU_ITEMS, MENU_TPL);
<div class="col3 right">
<a class="Emergency big">Emergency Codes:&nbsp;&nbsp;&nbsp; Blue 2222&nbsp;&nbsp;&nbsp;&nbsp;
Fire 7777&nbsp;<br /> IT Contacts: helpdesk@beaconhospital.ie </a>

<div class="row2">
<div class="container1">
<div class="col4 img2">
<img src="images/hospital.jpg" style="width: 233px; height: 127px;" />

<div class="col5">
<img src="images/logotest.jpg" style="width: 100%; height: 127px;" />

<div class="row3">
<div class="container2">
<div class="col6">
<table style="width: 176px; "top" >

<td bgcolor= "#006699"><div class="suckerdiv">
<ul id="suckertree1">
<li><a href="javascript:ajaxpage('index.htm', 'col12');"class="style42">Home</a></li>
<li><a href="" class="style42">Email </a></li>
<li><a href="" class="style42">Departments</a>
<li><a href="" class="style42">Policies &amp; Procedures</a></li>
<li><a href="" class="style42">Forms</a> </li>
<li><a href="" class="style42">Staff</a></li>
<li><a href="" class="style42">Self Help</a></li>
<li><a href="" class="style42">Internal Vacancies</a></li>
<li><a href="javascript:ajaxpage('index8.htm', 'col12');" class="style42" >Staff Benefits</a></li>
<li><a href="" class="style42">Links</a></li>

<div id="index.htm" class="col12">
<div class="col7">
<a class="H1">Staff Benefits</a>
<li>Employee Referral Bonus</li>
<li>Move to HR</li>
<li>Vodafone Employee offer</li>
<li>Changes in Flexible benefits</li>
<li>Pay Dates</li>
<li>My Hub-Payslips</li>
<li>Payslips Website</li>