简体   繁体   English

用javascript修改firebug dom对象

[英]modify firebug dom object with javascript

显示对象树的 Firebug 屏幕截图。

The screenshot of Firebug above shows the DOM objects from a site I have loaded.上面 Firebug 的屏幕截图显示了我加载的站点中的 DOM 对象。 Actually I am using a library (EditableGrid) to allow me editing a table called 'itemlist'.实际上我正在使用一个库(EditableGrid)来允许我编辑一个名为“itemlist”的表。

I want to set the columns property editable to false "on the fly" with JavaScript.我想使用 JavaScript 将editablecolumns属性“即时”设置为false In the header bar of Firebug I see Window > databgrid > editableGrid > columns > 3 .在 Firebug 的标题栏中,我看到Window > databgrid > editableGrid > columns > 3

Can anybody point me to the correct way on accessing and modifing the "editable" object attribute of column 3.任何人都可以指出我访问和修改第 3 列的“可编辑”对象属性的正确方法。

I tried in various combinations of我尝试了各种组合

var tbl = document.getElementById('itemlist');

var col = document.getElementClassName('window.datagrid.editableGrid.columns');
col.value = "true";

but I couldn't access the property.但我无法访问该属性。

document.getElementById() and document.getElementClassName() select HTML elements. document.getElementById()document.getElementClassName()选择 HTML 元素。 You want to access a DOM object.你想访问一个 DOM 对象。 Looking at the path shown within Firebug's DOM panel it should be accessible directly via datagrid.editableGrid.columns[3] .查看 Firebug 的DOM面板中显示的路径,它应该可以通过datagrid.editableGrid.columns[3]直接访问。

Sebastian was perfectly right.塞巴斯蒂安完全正确。 There is no need to retrieve the element via the DOM functions.无需通过 DOM 函数检索元素。

value = datagrid.editableGrid.columns[3];

Just retrieves the datastructure variable.只需检索数据结构变量。 I wasn't aware that black/bold colored objects could be set and get directly.我不知道可以直接设置和获取黑色/粗体颜色的对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM