I need a help on my javascript code, I found out that this code don’t work on mozilla firefox 3.0.11. It cannot read or process the lines document.getElementById(‘resultID’+id).getElementsByTagName(‘TD’);
where I used ‘resultID’ and a variable named id, example: the if the id=12 it should output resultID12 then get its value.
does anyone have an idea on how can i make this work? thanks in advance
//Update table properties
var lastId;
function showEditForm (id) {
//send properties'
var form = document.getElementById('fEdit');
var e = document.getElementById('resultID'+id).getElementsByTagName('TD');
var etdLength = e.length;
for (var i=0;i<etdLength;i++){
form.elements*.value = e*.innerHTML;
}
}
This is the part of the HTML Code
<table>
<tr>
<td class="tableControl1">
<img src="prev.png" alt="Prev" /> Page 1 of 1 <img src="next.png" alt="Next" />
</td>
<td class="tableControl2">
<input id="ifind" name="find" type="text" /> <a href="javascript:setFind();" ><img src="find.png" /> Find</a> <a href="javascript:showAll();" ><img src="showall.png" alt="Show All" /> Show All</a><!-- <img src="print.png" alt="Print"> </img>Print -->
</td>
</tr>
</table>
<div id="sTable"><table><tr><th>User ID</th><th>Username</th><th>Password</th><th>Type</th><th>Employee ID</th><th colspan=2>Action</th></tr><tr><span id="resultId0"><td>0</td><td>admin</td><td>admin</td><td>admin</td><td>0</td></span><td><input name="edit" type="image" src="edit.png" alt="Edit" onclick='showEditForm("0")' /></td><td><input name="delete" type="image" src="delete.png" alt="Delete" onclick='deleteData("uid","0")' /></td></tr><tr><span id="resultId26"><td>26</td><td>janet</td><td>12345</td><td>employee</td><td>1</td></span><td><input name="edit" type="image" src="edit.png" alt="Edit" onclick='showEditForm("26")' /></td><td><input name="delete" type="image" src="delete.png" alt="Delete" onclick='deleteData("uid","26")' /></td></tr><tr><span id="resultId27"><td>27</td><td>ronald</td><td>12345</td><td>employee</td><td>4</td></span><td><input name="edit" type="image" src="edit.png" alt="Edit" onclick='showEditForm("27")' /></td><td><input name="delete" type="image" src="delete.png" alt="Delete" onclick='deleteData("uid","27")' /></td></tr></table></div>
<table>
<tr>
<td class="tableControl1">
<img src="prev.png" alt="Prev" /> Page 1 of 1 <img src="next.png" alt="Next" />
</td>
<td class="tableControl2">
<span id="refreshLink">
<a href="javascript:refreshPage();" ><img src="refresh.png" /> Refresh</a>
</span>
<img src="total.png" /> Total: 3 </td>
</tr>
</table>
</div>
<div id="formEdit" style="display:none"><br>
<fieldset><legend>Edit User Account</legend>
<form id="fEdit" >
<table>
<tr>
<tr>
<input name="uid" type="hidden" value="NULL"/>
<td>Username <input name="uname" type="text" value="" /></td>
<td>Password <input name="upass" type="text" value="" /></td>
<td>Type <select name="utype">
<option value="admin">admin</option>
<option value="employee" selected="selected" >employee</option>
</select>
</td>
<td>Employee <select name="eid"><option value='0'>-none-</option><option value="1">Feratero, Janet</option><option value="4">Paborito, Ronald</option></select> </td>
<td><input name="btnSubmit" type="button" value="Submit" onclick="editData()"/></td>
</tr>
</tr>
</table>
</form>
</fieldset>
</div>
<div id="formAdd"><br>
<fieldset><legend>New User Account</legend>
<form id="fAdd">
<table>
<tr>
<tr>
<input name="uid" type="hidden" value="NULL"/>
<td>Username <input name="uname" type="text" value="" /></td>
<td>Password <input name="upass" type="text" value="" /></td>
<td>Type <select name="utype">
<option value="admin">admin</option>
<option value="employee" selected="selected">employee</option>
</select>
</td>
<td>Employee <select name="eid"><option value='0'>-none-</option><option value="1">Feratero, Janet</option><option value="4">Paborito, Ronald</option></select> </td>
<td><input name="btnSubmit" type="button" value="Submit" onclick="addData()"/></td>
</tr>
</tr>
</table>