Click to See Complete Forum and Search --> : Populate Text field


webumd
07-08-2004, 10:50 AM
Hi Everyone
I have a table on my form, I want to make the row clickable, so that, when i click on te row, the name in the row appears in a text box below the table. I dont know how to assign a value to a row ina table - like say for example, my table will have:

Name Phone
A 111
B 2222
C 3333

Now if i click on C, i want C to apear in a text box(which already exists) below the table.
Any ideas?

Thank you

neil9999
07-08-2004, 11:14 AM
Try this:

<script type="text/javascript">
function a(b){document.getElementById("letter").value=b;}
</script>
<style type="text/css">
td{cursor: hand}
</style>
</head>

<body>
<table><tr><td onclick="a('a')">A 111</td></tr>
<tr><td onclick="a('b')">B 222</td></tr>
<tr><td onclick="a('c')">C 333</td></tr></table>
<input type="text" id="letter" size="1" />


Hope that helps,

Neil

webumd
07-08-2004, 11:44 AM
Great!
thanx
Got any ideas on good JavaSCrip books or tutorials?
thx