blurredvision
Lifer
To make this as simple as possible, I'll describe a highly simplified version of a site I am designing.
Let's say I have a page that is separated into two divs, one on the left and one on the right. We'll call them "leftdiv" and "rightdiv". In "leftdiv", I currently have a working version of the fantastic php file tree, as seen here: http://abeautifulsite.net/note.../demo/demo_classic.php
What I would like to happen is that when I click on a file in that tree in "leftdiv", it will open that file in "rightdiv" without refreshing the entire screen.
I found this bit of code that does work, but I need it to be dynamic and show the file the user wants to see, not some canned text sitting in an array in the script code.
------------------------------------------------------------------
<script type="text/javascript">
function replaceContent(show) {
var display = new Array();
display[1] = "Some new content.";
display[2] = "Some other content.";
display[3] = "Some more content.";
document.getElementById("your_div").innerHTML = display[show];
}
</script>
<a href="#" onclick="replaceContent(1)">more1...</a>
<a href="#" onclick="replaceContent(2)">more2...</a>
<a href="#" onclick="replaceContent(3)">more3...</a>
<div id="your_div"></div>
------------------------------------------------------------------
Like I said, that code works, but I don't know anything about javascript. If I can get some help changing the javascript code above, I can take care of the rest. Those "onclick" events will simply be moved into argument for the php function to create the file tree.
I appreciate any help!
Let's say I have a page that is separated into two divs, one on the left and one on the right. We'll call them "leftdiv" and "rightdiv". In "leftdiv", I currently have a working version of the fantastic php file tree, as seen here: http://abeautifulsite.net/note.../demo/demo_classic.php
What I would like to happen is that when I click on a file in that tree in "leftdiv", it will open that file in "rightdiv" without refreshing the entire screen.
I found this bit of code that does work, but I need it to be dynamic and show the file the user wants to see, not some canned text sitting in an array in the script code.
------------------------------------------------------------------
<script type="text/javascript">
function replaceContent(show) {
var display = new Array();
display[1] = "Some new content.";
display[2] = "Some other content.";
display[3] = "Some more content.";
document.getElementById("your_div").innerHTML = display[show];
}
</script>
<a href="#" onclick="replaceContent(1)">more1...</a>
<a href="#" onclick="replaceContent(2)">more2...</a>
<a href="#" onclick="replaceContent(3)">more3...</a>
<div id="your_div"></div>
------------------------------------------------------------------
Like I said, that code works, but I don't know anything about javascript. If I can get some help changing the javascript code above, I can take care of the rest. Those "onclick" events will simply be moved into argument for the php function to create the file tree.
I appreciate any help!