Forum Moderators: open
i. have a list of services listed on one side of a table and when you click on the service name the description is displayed in other side of table. OR...
ii. have a list of services and when you click on the service name the description pops up.
I have been able to create ii. (with some strange code that doesn't use javascript) but cannot keep the definition on top. The first definition comes up on top but if you click on another definition is slips under the window. So I used
<onBlur="self.focus()">
to keep it on top, but the definition doesn't change when user clicks on a new list item and creates an awkward situation for the user --- having to close each definition window in order to access another definition.
I have all the definitions saved as individual files, so maybe I should be using embedded files? I'm sure this is a simple thing, I just can't seem to get it to work.
<HEAD>
<SCRIPT language=Javascript>
function showText(whichText) {
theText = new Array('apples','oranges','bananas');
document.getElementById('dynamic').innerHTML = theText[whichText];
}
</SCRIPT>
</HEAD>
<BODY>
<P><A href="#" onclick="showText(0)">One</A>
<P><A href="#" onclick="showText(1)">Two</A>
<P><A href="#" onclick="showText(2)">Three</A>
<HR>
<P>
<div id=dynamic></div>
</BODY>
document.getElementById('dynamic').firstChild.nodeValue = theText[whichText]; (assuming firstChild exists for an empty div - might want to check that ;))