Click here to Skip to main content
15,891,940 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Create a dynamic table in java script for mozilla firefox.
In my table their are few text box and few drop down list are added.
i want to disable the dropdown list. How to do this ?

I used this code for disable :

var destpageno = trim(document.getElementById("tbl").rows(i).cells(6).children[0].value);

var destpageno = trim(document.getElementById("tbl").rows(i).cells(6).children[0].disabled=true);


This is not working in Mozilla firefox : The error is produced:

Error:::
MIDL
Error: document.getElementById("tbl").rows is not a function.


Please help me.
Posted
Updated 7-Dec-10 3:03am
v2

try rows[i] instead of rows(i).

Good luck!
 
Share this answer
 
Comments
upendranath33 8-Dec-10 1:33am    
Thanks For help.
Your code didn't work in FireFox allright and neither in IE
My example works in both IE and FireFox. All these variables
in function onLoad() were introduced so I could see in FireBug
what was happening at each seperate step. Here we go:

JavaScript
<html>
<head/>
<body onload="onLoad();">
<table id="tbl">
	<tbody>
		<tr>
			<td><span>1. Cell</span><td/>
			<td><span>2. Cell</span><td/>
			<td><span>3. Cell</span><td/>
			<td><span>4. Cell</span><td/>
		</tr>
	</tbody>
</table>
<script type="text/javascript">
   function onLoad()
   {
	   var table = document.getElementById("tbl")
	   var rows = table.tBodies[0].rows;
	   var row = rows[0];
	   var cells = row.cells;
	   var cell = cells[0];
	   var children = cell.children;
	   var child = children[0];
	   alert(child.innerHTML);
   }
</script>
</body>
</html>


If you're developing for FireFox please consider using FireBug that is a real
life saver! :-D

Cheers,


Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900