我有一个表名为“recordsource”的属性,该属性将保存将填充表的内容的对象的名称。设置一个属性作为对象的引用
<table id="tbl" recordsource="myobj">
现在,这里是我的功能:
var myobj;
function obj()
{
this.code = new Array();
this.name = new Array();
}
myobj = new obj();
myobj.code = ["a","b","c"];
myobj.name = ["apple","banana","carrot"];
function populate_table()
{
mytable = document.getElementById("tbl");
mytableobj = mytable.getAttribute("recordsource"); //this will return a string
//my problem is how to reference the recordsource to the myobj object that have
//the a,b,c array
}
你的意思'myobj.recordsource = mytable.getAttribute( '记录源');'?或者你的意思是你希望myobj中的数据存储在'mytable.setAttribute('recordsource',..'? – bokonic 2012-07-12 02:40:01
同意@bokonic。你在这里的目标是什么? – 2012-07-12 02:45:50
@bokonic既不是先生,但那是可能的吗?我的意思是我只是将recordource放在table标签上,然后setAttribute到我想参考的实际对象上 – 2012-07-12 03:12:41