0
動的に追加されたフォーム要素を使ってWebフォームを作成しました。その後フォーム要素をナビゲートする方法
document.write('<fieldset name="field__collection__">') ;
document.write('<legend align="right" style="color:#FF0066"><code>COLLECTION</code></legend><br />') ;
document.write('</fieldset') ;
: 私は私が興味を持ってフィールドセットでいくつかの選択ボックスを挿入 、いくつかの条件が満たされたときにfieldsetの数を作成し、
例えば、私は次のようにフィールドセットを作成します、フィールドセットにアクセスし、私は選択ボックスを作成するために:
var html = form.elements["field__collection__"].innerHTML ;
for(netelement in CUSTOM)
{
html = html + '<fieldset><legend align="left" style="color:#888888"><code>'+ netelement +'</code></legend>'
var x = "__collection__" +'###'+ netelement +'###' ;
html = html + '<select name=\"'+ x +'\" multiple="true" size="5" onsubmit="document.getElementById(\'MAIN\').submit()">' ;
for(collection in CUSTOM[netelement])
if(collection != "icollection")
html = html + '<option>'+collection+'</option>' ;
html = html + '</select>' ;
html = html + '</fieldset>' ;
}
form.elements["field__collection__"].innerHTML = html ;
の問題は、私のようなフィールドセットにアクセスできることです。form.elements["field__collection__"]
をし、これは、Firefox、サ上で動作しますfari、Opera、Chrome、IE8では動作しません(問題はinnerHTMLではありません)。 具体的には、はIE8では未定義です。
は、あなたの興味のためにアダムありがとうございました。あなたが書いたのはFirefox上で動作しますが、IEの場合はそうではありません。このようなことが起こる理由は何ですか? – user690182