Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   question 4 JScript Universal Guru: iframe: clone node & contentWindow (http://www.velocityreviews.com/forums/t931643-question-4-jscript-universal-guru-iframe-clone-node-and-contentwindow.html)

Dmitry Kulinich 06-15-2007 07:04 AM

question 4 JScript Universal Guru: iframe: clone node & contentWindow
 
It is really simple, yet I can't resolved more than week. I've read everything in msdn and iframes and tried in many many ways. Sorry 4 such a long letter.
1 Need to clone <tr> with <iframe> that contains <form> and hidden <input>s:
commented doesn't works:
function cloneRow(tr)
//var frame = document.getElementById("1");
//1
//var tr2 = tr.cloneNode(false);
//tr2.insertAdjacentHTML('afterBegin', tr.innerHTML);//first <td> open tag are not copied
//2
//var tr2 = tr.cloneNode(false);
//tr2.innerHTML = tr.innerHTML; //first <td> open tag are not copied
//3
//var tr2 = tr.cloneNode(false);
//tr2.insertAdjacentElement('afterBegin', tr); //existing element deleted and inserted again
// 4 copy iframe content child-by-child with DOM and insertAdjacentElement
// a lot of code but doesn't inserted properly - existing element deleted and inserted again
//5
tr2=tr.cloneNode(true);
if (tr.outerHTML.indexOf('IFRAME') != -1){

var _length = tr2.getElementsByTagName("IFRAME").length;

for (var i = 0; i < _length; i++) {

tr2.getElementsByTagName("IFRAME")[i].outerHTML = tr.getElementsByTagName("IFRAME")[i].outerHTML;

}}

//....a lot of code there, cleaning values in new row , setting new ones

return tr2;
}

2 Need to access contentWindow.document of new row, but it doesnt exists!:
function VectorDrawing_CreateImageURL (value)

{

var bgColor = this.getInputElement().bgColor;

var fgColor = this.getInputElement().fgColor;

var width = this.getIFrame().width;

var height = this.getIFrame().height;

var frameDoc = this.getIFrame().contentWindow.document;//Unspecified error

frameDoc.body.innerHTML = this.getIFrame().innerHTML;//body is null or not an object

frameDoc.getElementsByName("value")[0].value = value;

frameDoc.getElementsByName("bgColor")[0].value = bgColor;

frameDoc.getElementsByName("fgColor")[0].value = fgColor;

frameDoc.getElementsByName("width")[0].value = width;

frameDoc.getElementsByName("height")[0].value = height;

frameDoc.getElementById("form"+this.getAttribute(" elNo")).submit();

}

3 So, we need to copy (1) in such way that structure of iframe internal document must be saved or access (2) contentWindow.document in another way.

--
Thank you,
De Cool (ICQ:213679052),
EPE


All times are GMT. The time now is 02:55 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.