PDA

View Full Version : Need help in setting form variables


javaspace
02-18-2003, 08:59 PM
Hi:

I am desiginig to build a web page with list of items to the left with scroll bars. To the right of the page I want to show the item descriptions.

When I load the page I want all the data for all items loaded, but show 1st items description on the right hand side. The rest of the descriptions must be hidden.

When the user clickon a different Item on the left side I want to do onclick event and hide the 1st item description and show the description for the item clicked on.

I am thinking that each description would have a unique ID for example desc01.... desc10. and the Item number onclick will send to a java script the id. Based on this ID the javascript should make the data for that description visible.

Example Item:1234 on click will send (5) to a javascript called enabledesc(5).
Now the javascript then should enable desc[5] and hide desc[1].

Can some one show me how to enable and disable using javascript. Thanks for your help in advance.

joeframbach
02-19-2003, 01:31 AM
var disc=["desc1","desc2","desc3","desc4","desc5","desc6","desc7","desc8","desc9","desc10"];
function showDisc(index)
{
document.getElementById("discription").innerHTML=disc[index]
}

<table width="100%">
<tr><td align=left>
<input type=text onFocus="showDisc(0)"><br>
<input type=text onFocus="showDisc(1)"><br>
<input type=text onFocus="showDisc(2)"><br>
<input type=text onFocus="showDisc(3)"><br>
<input type=text onFocus="showDisc(4)"><br>
<input type=text onFocus="showDisc(5)"><br>
<input type=text onFocus="showDisc(6)"><br>
<input type=text onFocus="showDisc(7)"><br>
<input type=text onFocus="showDisc(8)"><br>
<input type=text onFocus="showDisc(9)"></td>
<td align=right id="discription"></td></tr>
</table>