Hello, I am having an issue with using javascript innerhtml. I am making a page which changes a divs content when someone clicks a button. I tried using php to include the file when the button is clicked and it dosent do anything... I dont know much about javascript so I'd appreciate any help!
Here's my code.
HTML Code:
<html>
<head>
<script language="javascript">
function viewTest() {
document.getElementById("other").innerText = "<br /> <?php include 'test.php'; ?>";
}
function viewTest2() {
document.getElementById("other").innerHTML = "<br /> <?php include 'test.php'; ?>";
}
</script>
</head>
<body>
<div id="centerbody">
<div id="smallwebsitename" onclick="viewTest();">Link One</div>
<div id="smallwebsitename" onclick="viewTest2();">Link Two</div>
</div>
<div id="other">
</div>
</body>
</html>
And heres the code from test.php
PHP Code:
<?php include 'databasesettings.php';
$result = mysql_query("SELECT * FROM #### WHERE ##") or die(mysql_error());
?> <table id="updates"> <td colspan="5" align="center" id="none">DATES</td> <tr id="tablehead"> <td>Date</td> </tr> <?php while($row = mysql_fetch_array( $result )) { ?> <tr id="update"> <td align="center"><?php echo $id = $row['date']; ?></td> </tr></a> <?php } ?>
</table>
Thanks for any help!
-Dillon
|