I have an upload script that loads into an iframe(‘upload’) within an iframe(‘content’);
It passes a user entered value to a function uploaded() in ‘content’ as follows;
top.content.uploaded(value);
This works just fine in all major browsers.
However, I needed to assign the iframe called ‘content’ a dynamically generated name, so it might now be called, say, ‘content12345’. I store the ‘12345’ value in a hidden input field in the top document so that it can be referenced from any iframe.
I thought this should work…
csx = top.document.getElementById(‘csx’).value;
contentid = “top.content” + csx;
contentid.uploaded(value);
…but it genereates an error “top.contentid is undefined”. Note that it collects the value of csx correctly.
How do I dynamically name the iframe reference within the javascript and call a function within that iframe?