
April 24th, 2004, 03:49 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
calling getElementById
HI!
I have a listbox with some values
I wanna update those values witin this td cell
I can get the value in a textbox
but i want the value to be presented in the cell data <td>
instead of the textbox
check out my listing...
BTW one of the functions is from this forum,
but I can't get it to really work.
Code:
<html>
<head>
<script language="javascript">
function disp()
{
option=document.forms[0].selPatchtyp.options[document.forms[0].selPatchtyp.selectedIndex].text
txt=option
// document.forms[0].favorite.value=txt
// document.forms[0].gurka.value=txt
alert(txt)
change(gubbel,txt)
}
function change(div_id,val){
elm=document.getElementById(div_id);
elm.innerHTML=val;
}
</script>
</head>
<body>
<form name="hert">
<table>
<tr>
<td><div id="gubbel"><p value=txt></p></div></td>
</tr>
</table>
<select name="selPatchtyp" onchange="disp()">
<option>Hej
<option>Pa
<option>Dig
<!-- <option selected name="1" value="odd">odd</option>
<option name="2" value="odd_pt">Udda Pigtail single</option>
<option name="3" value="odd_rb">Udda Pigtail ribbon</option>
--> </select>
</form>
</body>
</html>
Last edited by stumpy : April 27th, 2004 at 06:36 AM.
Reason: Code placed in [code] tags
|