Having Trouble With Form in Shadowbox

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Having Trouble With Form in Shadowbox

I'm trying to dynamically add a textarea to a form in a Shadowbox:

<script type="text/javascript" src="../tb_2013/shadowbox-3.0.3/shadowbox.js"></script>                <script type="text/javascript"> Shadowbox.init({ }); function uploadImageSB() { // shadowbox for image upload Shadowbox.open({ content: 'http://mydomain.com/cgi-bin/photo.cgi?function=photo_upload', player: 'iframe', title: 'Image Upload', height: 200, width: 500, options: { onOpen: function() { var ed = tinymce.activeEditor; // get editor instance var content = ed.save(); // get the editor content var ta = document.createElement('textarea'); ta.textContent = content; ta.name = 'editor'; ta.value = ta.textContent; var iframe = document.getElementById('sb-player'); var iframeContent = iframe.contentWindow.document; var form = iframeContent.document.getElementById('photoForm'); form.appendChild(ta); } } }); }; </script>

The problem is this line of code:

var iframe = document.getElementById('sb-player');

When I test this in Firefox, it tells me that iframe = null.

How do I access the iframe?