[html5] Setting field in a different frame from javascript

Larry Martell larry.martell at gmail.com
Thu May 8 12:49:44 PDT 2014


I have some javascript code, and I want to set the value of a field
that's in a different frame. The line in my js code to this is:

window.frames.header_frame.document.getElementById('sort_key').value = this.id

When that line executes, I get an error:

window.frames.header_frame is undefined

But if I set a breakpoint on that line, and when it's hit access that
element from the js console it works:

>>> window.frames.header_frame.document.getElementById('sort_key')

<input id="sort_key" type="hidden" name="sort_key">

What am I doing wrong in my script that is preventing me from
accessing that field?

TIA!
-larry


More information about the Help mailing list