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++;
}
精彩评论