My problem is this. I have javascript that when a link is clicked it displays the link in a layer over the current page. The new layer is included using the php include command. However when the new layer is displayed, the javascripts that are supposed to run in the new layer do not work.
Code examples follow:
Original page:
<head>
<script src="scripts/createAjaxObject.js" type="text/javascript" language="javascript"></script>
<script src="scripts/radiocheck.js" type="text/javascript" language="javascript"></script>
<script src="scripts/popupscript.js" type="text/javascript" language="javascript"></script>
</head>
<body>
<?php include('search.php'); ?>
<table id="blocks">
<tr><td>
<h1><a onClick="javascript:displaysearch();">Search</a></h1>
</td></tr>
</table><br />
The search page that's included:
<div id="searchpopup">
<div id="closeBox">Close ⊗</div>
<div id="wrapper">
<div id="popupcontent">
content...
<p>
<input name="searchType" type="radio" value="general" id="generalsearch" onClick="changeInfo('general','single');">
<label for="generalsearch">Search for multiple pigs based on general information.</label>
</p>
</div>
</div>
</div>
The javascripts:
function createObject()
{
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer")
{
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
function changeInfo(type1, type2)
{
document.getElementById(type1 + "Display").style.display = 'block';
document.getElementById(type2 + "Display").style.display = 'none';
}
function showInfo(type)
{
if(document.getElementById(type + "Display").style.display == 'none')
{document.getElementById(type + "Display").style.display = 'block';}
else
{document.getElementById(type + "Display").style.display = 'none';}
}
function displaysearch()
{
document.getElementById('searchpopup').style.display = 'block';
document.getElementById('closeBox').onclick = function(){document.getElementyById('searchpopup').style.display = 'none';}
}
Now when I click the link on the original page is shows the searchpopup just fine. However, my closebox doesn't actually hide the searchpopup and the changeinfo() does not seem to show/hide the information it's supposed to either. Do I have to have the actual php/hmtl in the original file and not included using the php include command?