は、チェイスにカット:はiFrameの内部のテキスト入力(Googleフォーム)にアクセスする - Javascriptを
私はGoogleが調査を形成し、基本的に私は動的にテキストの入力のうちの1つを編集する必要があります。 Javascriptがそれを追加しますので
フォームの調査では、実際には1〜6のうちの可能な調査である: '<iframe name="survey" id="ifrm" src="https://spreadsheets.google.com/spreadsheet/embeddedform?formkey=dHpYM1NvTFN4OElNWnBJWUtjdHhld2c6MQ" width="760" height="623" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>'
トラブルはそのテキストボックスにアクセスしている - 私はiFrameのが正しくロードされるまで待つようにsetTimeout()
を使用しました。そして、私はこれをやりたい:
function writeEncoded() {
alert("now attempting to inject");
var iF = document.getElementById('ifrm');
alert(iF);
//works up to here
var form = iF.contentWindow.document; //does not run.
alert (form);
form.getElementById('entry_3').value = "Hi";
}
何か問題が起こっている? ありがとうございます。そのそれはjavascriptの階層構造ブラウザに2つの場所に「住む」に
ああ、チップのおかげで。私はちょうどGoogleの調査書をコピーして、自分のサーバー上でhtmlにします。 – Xrave