Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > question 4 JScript Universal Guru: iframe: clone node & contentWindow

Reply
Thread Tools

question 4 JScript Universal Guru: iframe: clone node & contentWindow

 
 
Dmitry Kulinich
Guest
Posts: n/a
 
      06-15-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
To clone or not to clone.. lordy Java 3 07-07-2006 04:30 PM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
Sigma Announces SD-30--30 Megapixel,Universal Lens Mount, Digital SLRSigma Announces SD-30--30 Megapixel,Universal Lens Mount, Digital SLR sigmaphotojapan@yahoo.com Digital Photography 6 04-01-2005 05:26 PM
Sigma Announces SD-30--30 Megapixel,Universal Lens Mount, Digital SLRSigma Announces SD-30--30 Megapixel,Universal Lens Mount, Digital SLR sigmaphotojapan@yahoo.com Digital Photography 5 04-01-2005 02:08 PM



Advertisments