开发者

How to set an element of another iframe?

I am trying to set element from one iframe to another.

window.iframes["test"].document.getElementById('lDownload').setAttribute('target',"_blank")
            //document.getElementById('lDownload').setAttribute('target',"_blank")
  开发者_开发知识库          window.iframes["test"].document.getElementById('lDownload').setAttribute('href',downloadFilename)
        }
        else
        {
            //noProcess();
            window.frames["test"].document.getElementById('lDownload').setAttribute('href',"javascript:noProcess()")                
        }


-- To reference iframe javascript/document

parent.frames("test").yourIframeFunction();

OR

parent.frames[0].yourIframeFunction();

-- To reference parent/top document's javascript/document

parent.yourMainDocumentFunction();


-- To reload iframe content


countRefreshes = 0;
function refreshIframe(which) {
    var currHref = '' + parent.frames[which].location + '';
    parent.frames[which].location.href = currHref + '?c=' + countRefreshes + '';
    countRefreshes++;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜