我有一個表名爲「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