I want to load a file when on click on the different text in another div. I have 5 div. And also I need to fix some default content in all the div. div should override and call the file when clicking on the text which is in another div. I am able to call two files in two different files when I click on the text in the left div. But when I try to pass a string from PHP to javascript I am not able to do that. I want to parameterize the link to the different text. How can I achieve this? If I try to assign a PHP variable to it is giving nothing in output. Thanks in advance.
<html>
<head>
<title>A div layout</title>
</head>
<body>
<script>
function load_home(link){
document.write(link);
var project="<?php echo $name; ?>";
var table_link='table_'+link+'.php';
var graph_link='graph_'+link+'.php';
document.getElementById("tables").innerHTML='<object type="type/html" data="table_link" height=100% width=100%></object>';
document.getElementById("graph").innerHTML='<object type="type/html" data="graph_link" height=100% width=100%></object>';
}
</script>
<div id="header" style="width: 100%; height:7%; background-color: green; color: white;">Merahkee Tech Solutions
</div>
<div id="tree" style="width: 20%; height:88%; background-color: pink; color: white; float:left">
<?php
$name="customer";
echo '<nav>
<ul>
<li><a href ="#" onclick="load_home('.$name.')">Pebble</a></li>
<li><a href ="#" onclick="load_home()">Jenkins</a></li>
<li><a href ="#" onclick="load_home()">Tomcat</a></li>
<li><a href ="#" onclick="load_home()">Jira</a> </li>
</ul>
</nav>'
?>
</div>
<div id="tables" style="width: 80%; height:35%; background-color: skyblue; color: white; float:left">This is default content
</div>
<div id="graph" style="width: 70%; height:53%; background-color: lightblue; color: white; float:left">This is trial graph div
</div>
<div id="dropdown" style="width: 10%; height:53%; background-color: pink; color: white; float:left">This is trial dropdown div
</div>
<div id="footer" style="width: 100%; height:5%; background-color: green; color: white; float:left">This is a footer div
</div>
</body>
Now I am not getting anything once I click on text in the first div.