AJAX doesn't automatically import javascript in the same way as loading the page into its own window or an iframe will. Usually there are workarounds though.
I don't really get what your script is doing. Looks like some kind of a menu. Generally those sorts of scripts initialize onload of the DOM (document.ready in jQuery) or onload of the page. There are no load events when importing via AJAX. There is an onreadystatechange event and it's used to determine when the requested content is available. When it is, it's injected into the page. Right after that is often the opportunity to initialize that content to a script or scripts. But there are also other strategies. Chief among those is instead of initializing any content, have the script it listen for events. If these events occur on content that fits certain criteria, it can react in the manner it previously would have had it initialized that content.
Both of these methods involve having your other script(s) and style(s) already on the 'top' page.
The document ready code in this case appears to be in featured.js and is the only thing in that script:
Code:
$(document).ready(function(){
$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs({event:"mouseover"}).tabs("rotate", 29000, true);
});
Which appears to use the jQuery UI tabs method to make some kind of rotating nav setup. Here's what I would suggest. Get rid of the highlighted:
Code:
<div id="leftcolumn">
<a href="#" onmouseover="javascript:ajaxpage('ajaxfiles/tour.html', 'rightcolumn'); loadobjs('css/style.css', 'css/slide.css', 'js/jquery1.3.2-min.js', 'js/jquery-ui1.5.3-min.js', 'js/featured.js')">See Hotel</a>
Put those styles and scripts (except for 'js/featured.js) on the 'top' page. Then in ajaxload.js around line #34:
Code:
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
Make that like so:
Code:
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
document.getElementById(containerid).innerHTML=page_request.responseText;
$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs({event:"mouseover"}).tabs("rotate", 29000, true);
}
}
The browser cache may need to be cleared and/or the page refreshed to see changes.
Bookmarks