Discussion Locked

Looking for a Javascript

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi....
I have developed a web page with 2 side-by-side columns in a table. I am looking for a javascript that would allow a user to click on a hyperlink on the left column and have the content for that link appear in the right column without using frames or opening a new window. Does anyone know of such a script, or if it is even possible to do that? I have scoured all the regular free javascript sites with no luck. Thanks for any help you can give.

Ken

6 replies

by ed woychowsky

Depending on the browser it should be possible. By using an XML Data Island in Internet Explorer the link could change the second bound column and thus change the data. Another way is to use XMLHTTP and the DOM; the link would execute a JavaScriptfunction that would retrieve the necessary information from the server. This information would then update the contents of the appropriate TD tag by using the HTML DOM. A third possibility is to use a hidden frame whose contents can be copied to the column.

The second method has the advantage that it can be somewhat cross-browser compatible, the latest versions of Mozilla and possibly Netscape supports XMLHTTP. The advantage of the third is that it would work on most browsers.

by program

I know that you said that you are reluctant to use Frames but an IFRAME might do the trick here

by pranav

Yes! The answer for your mystery is DOM
In your left row put this:

Left

Javascript:
function setCell()
{
var new_cell = object.cellIndex + 1;
new_cell.innerHTML = "show the output here", as if you had a linklike new window.

}

You will have to work with this a little. I am using something that I had done earlier, which is similar to but not exactly what you have. Try it.

Pranav

by soring9

give an ID for your cell
and onclick execute show_content() function.

so this is the generic ideea.
you can use style="overflow:auto;" if U will have in second cell too big content, and you want to keep proportion of cells in table.

other sugestion ..
u can use arrays to store messages
and then U can add a parameter in function
to set which message from array will be extracted link .

U can see this at www.horeca-messiaen.be/beta
I redesign this site now -> and I use this method
for a large number of links ( on each pressed link I have to change text on a cell / image on other cell ).

code is small an simple to understand

Pranav solution also good & simple.

by soring9

- pass the real problem to me and I try to make your script
use soring9@bistrita.astral.ro mailadress

This discussion is closed to new replies.