1

scriptaculose / protocol Builderを使用して、TRとTDを作成しました。colspanはIEでは機能しませんが、FFとChromeでは機能します。この問題について何か経験はありますか?

これはIEでは機能しませんが、FFとChromeでは機能します。

Builder.node('td',{'colspan':'12','class':'bdr-bottom'},(noteText))

これはIE、FF、Chromeで機能します。

for (var i=1; i<numCols; i++)
{       
    noteRowSpan=Builder.node('td',{'class':'bdr-bottom'},(''));     
    $(noteRow2).insert($(noteRowSpan));  
}       
4

2 に答える 2

0

以下のようなものを使用する場合new Element()、エフェクトが必要でない限り、scriptaculousライブラリをロードする必要はありません-これらはコードPrototypeJSフレームワークに組み込まれています。

これ

Builder.node('td',{'colspan':'12','class':'bdr-bottom'},(noteText))

に変更することができます

new Element('td',{'colspan':12,'class':'bdr-bottom'}).update(noteText);

これ

for (var i=1; i<numCols; i++)
{       
    noteRowSpan=Builder.node('td',{'class':'bdr-bottom'},(''));     
    $(noteRow2).insert($(noteRowSpan));  
}

これに変更することができます

for(var i=1 ; i<numCols; i++)
{
    noteRowSpan = new Element('td',{'class':'bdr-bottom'});
    $(noteRow2).insert(noteRowSpan);
    //if noteRow2 is created with new Element() you don't need to re-extend it do it like this
    noteRow2.insert(noteRowSpan);
}

フォローアップのために編集

メソッドのパラメーターはnew Element()子要素ではなく、作成する要素の属性です。

あなたがしたいことのために

noteRow1= new Element('tr',                           
                   new Element('td',{'class': 'bld rt'},'Date:'),
                   new Element('td').update(noteText)
                   ); 

このように行う必要があります

noteRow1= new Element('tr');
noteRow1.insert(new Element('td',{'class': 'bld rt'}.update('Date:'));
noteRow1.insert(new Element('td').update(noteText));

または一緒にチェーン

noteRow1= new Element('tr').insert(new Element('td',{'class': 'bld rt'}).update('Date:')).insert(new Element('td').update(noteText));

また、ガイドラインのメモとして-コメントリンクをクリックしてフォローアップの質問をすることができます

于 2012-11-15T02:31:22.893 に答える
0

ありがとう。新しい要素を使用していますが、正常に動作します。ネストされた新しい要素を使用するには? コードが機能していません:

noteRow1= new Element('tr',                           
                       new Element('td',{'class': 'bld rt'},'Date:'),
                       new Element('td').update(noteText)
                       );       

ありがとう。

于 2012-11-28T19:22:19.657 に答える