I'm trying to create a menu bar that will refresh a DIV when a button is clicked. I had earlier success with this when it was only one button but now I want the same affect from ten buttons as well as the original first button.
The func.php file
function loggedin()
{
print"
<div class=\"container\">
<div class=\"titlebar\">
</div>
<div class=\"spacerH\">
</div>
<div class=\"navbar\">
<div class=\"menubuttonsl\"></div>
<div class=\"menubuttonsl\"><a class=\"home_out\" onClick=\"changeContent(1);return false;\" title=\"HomePage\"></a></div>
<div class=\"menubuttonsl\"><a class=\"email_out\" onClick=\"changeContent(2);return false;\" title=\"Messages\"></a></div>
<div class=\"menubuttonsl\"><a class=\"notify_out\" onClick=\"changeContent(3);return false;\" title=\"Notifications\"></a></div>
<div class=\"menubuttonsl\"><a class=\"mine_out\" onClick=\"changeContent(4);return false;\" title=\"My Stuff\"></a></div>
<div class=\"menubuttonsl\"><a class=\"comm_out\" onClick=\"changeContent(5);return false;\" title=\"Community\"></a></div>
<div class=\"menubuttonsl\"><a class=\"live_out\" onClick=\"changeContent(6);return false;\" title=\"Live Action\"></a></div>
<div class=\"menubuttonsl\"><a class=\"hot_out\" onClick=\"changeContent(7);return false;\" title=\"What's Hot\"></a></div>
<div class=\"menubuttonsr\"><a class=\"im_out\" onClick=\"changeContent(10);return false;\" title=\"Instant Messanger\"></a></div>
<div class=\"menubuttonsr\"><a class=\"upload_out\" onClick=\"changeContent(9);return false;\" title=\"Upload Pics/Vids/Audio\"></a></div>
<div class=\"menubuttonsr\"><a class=\"rate_out\" onClick=\"changeContent(8);return false;\" title=\"Rate Pics\"></a></div>
</div>
<div class=\"header2\"><div id=\"myTable\">";
print"</div></div>
</div>
";
}
The hopeful JavaScript on index.php
<script>
function changeContent(display)
{
document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML;
}
</script>
<script type="text/html" id="showTable">
if (display=='signup') {<?php bottomtable2(); ?>}
else if (display=='1') {<?php MainPanel(); ?>}
else if (display=='2') {<?php Messages(); ?>}
else if (display=='3') {<?php Notifications(); ?>}
else if (display=='4') {<?php MyStuff(); ?>}
else if (display=='5') {<?php Community(); ?>}
else if (display=='6') {<?php LiveAction(); ?>}
else if (display=='7') {<?php WhatsHot(); ?>}
else if (display=='8') {<?php RatePics(); ?>}
else if (display=='9') {<?php Upload(); ?>}
else if (display=='10') {<?php IMessenger(); ?>}
</script>
The original JavaScript that work perfectly with only the one case
<script>
function changeContent()
{
document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML;
}
</script>
<script type="text/html" id="showTable">
<?php bottomtable2(); ?>
</script>
I'm not against creating new JavaScript for the ten additions but thought I could tie into the existing and working script. The result is I've totally lost the affect and get no reaction to any of the onClicks tho I do get "} else if (display=='1') {} else if (display=='2') {} else if (display=='3') {} else if (display=='4') {} else if (display=='5') {} else if (display=='6') {} else if (display=='7') {} else if (display=='8') {} else if (display=='9') {} else if (display=='10') {}" printed at the top of my page for some reason. What am I missing?