Morisatwork
01-25-2007, 12:36 AM
1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
3) Describe problem: Page not Displaying second time clicked
Hi Guys
I have added the following code to automatically load a page from a menu/link call. The page in question loads ok the first time however if it is called again it is not displayed ie the user will need to manually select the page from the page
the menu call is : customercare.asp?page=privacypolicy.htm
and there are a number of such pages.
My javascript knowledge is in an embryonic stage so I am not sure what to be looking for.
I do not think I have changed the original Dynamic Ajax Content code.
In head
<script language="JavaScript" type="text/JavaScript">
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, 'thecontent');}
else
{ajaxpage('privacypolicy.htm', 'thecontent');}
}
</script>
in body
<body onLoad="javascript:window.print();">
<script type="text/javascript">
window.onload = loadstart();
</script>
thanks
Moris
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
3) Describe problem: Page not Displaying second time clicked
Hi Guys
I have added the following code to automatically load a page from a menu/link call. The page in question loads ok the first time however if it is called again it is not displayed ie the user will need to manually select the page from the page
the menu call is : customercare.asp?page=privacypolicy.htm
and there are a number of such pages.
My javascript knowledge is in an embryonic stage so I am not sure what to be looking for.
I do not think I have changed the original Dynamic Ajax Content code.
In head
<script language="JavaScript" type="text/JavaScript">
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, 'thecontent');}
else
{ajaxpage('privacypolicy.htm', 'thecontent');}
}
</script>
in body
<body onLoad="javascript:window.print();">
<script type="text/javascript">
window.onload = loadstart();
</script>
thanks
Moris