It works fine for me in all browsers if everything is in the <head> section, like this:
Code:
<head>
/* your meta tags go here */
<script type="text/javascript">
/* you can place other javascript functions here if you need */
function getQueryValue(name) {var match = (new RegExp('[?&;]' + name + '=([^&;#]*)')).exec(document.URL);
return match ? unescape(match[1]) : null;
}
function loadstart(){
var page = getQueryValue('page');
if(page != null)
{
ajaxpage(page, 'contentarea');
}
else
{
ajaxpage('./default.html', 'contentarea');
}
}
window.onload = loadstart;
</script>
</head>
'default.html' should be replaced with the name of your default content for a nomal page entry. External page calls from a url in the form of:
Code:
<p>Click <a href="./displayajaxstuff.html?page=specialpage.html>here</a> to see for yourself!</p>
This means that the getQueryValue function looks in the URL for the string 'page' (but you could use something else if you want) after the question mark , and retrieves the associated string, then places it in the ajaxpage function argument, which then fills the page with the requested content. You also must make sure that your <div> id is the same as that used in the ajaxpage() function call inside function loadstart() - in the above case it is called 'contentarea'. The last assumption is that both 'default.html' and 'specialpage.html' are in the same directory as the 'displayajaxstuff.html' and the external calling page. If they aren't, then you have to change the paths correctly..... I hope this will get you going.
Bookmarks