スペースフィールドを配置し,そこに日付/金額/摘要 のテーブルを配置しています。
金額欄だけ右寄せしたいのですが,どうしたらいいでしょうか?
金額欄のtdにclass="kingaku"などとして,cssで設定したいのですが,classを与える?方法がわかりません。
コードは,省略していますが,以下のような感じにしています
function dspR(records){
var recUrl = location.protocol + '//' + location.hostname + '/k/' + *** + '/show#record=';
var S2tbl = document.getElementById('r2_table');
S2tbl.innerText ='';
var thead = document.createElement('thead');//表のヘッダ
var tr =document.createElement('tr');
var th1 = document.createElement('th');
th1.innerText ='';
var th2 = document.createElement('th');
th2.innerText ='日付';
var th3 = document.createElement('th');
th3.innerText = '金額';
var th4 = document.createElement('th');
th4.innerText = '摘要';
(略)
S2tbl.appendChild(thead);//テーブルの子要素thead
thead.appendChild(tr);//theadの子要素tr
tr.appendChild(th1);//trの子要素thを作る
tr.appendChild(th2);
tr.appendChild(th3);
tr.appendChild(th4);
for (var i = 0; i < records.length; i++){
var record = records[i];
var row = S2tbl.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
(略)
cell1.innerText = record.日付.value;
cell2.innerText = record.金額.value;
cell3.innerText = record.摘要.value;
(略)