Mozilla firefox的Java脚本代码中的问题 [英] Problem in java script code For Mozilla firefox

查看:119
本文介绍了Mozilla firefox的Java脚本代码中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Java脚本中为mozilla firefox创建了一个动态表.
在我的表格中,添加了很少的文本框和下拉列表.
我想禁用下拉列表.该怎么做?

我将此代码用于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);


在Mozilla firefox中不起作用:产生错误:

错误:::

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:::

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


Please help me.

推荐答案

尝试rows[i]而不是rows(i).

祝您好运!
try rows[i] instead of rows(i).

Good luck!


您的代码在FireFox中无法正常运行,在IE中也无法正常运行
我的示例在IE和FireFox中均适用.所有这些变量
在功能onLoad()中进行了介绍,因此我可以在FireBug中看到
在每个单独的步骤中发生了什么.我们开始:

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:

<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>



如果您正在为FireFox开发,请考虑使用真正的FireBug
救生员! :-D

干杯,


曼弗雷德(Manfred)



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

Cheers,


Manfred


这篇关于Mozilla firefox的Java脚本代码中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆