i have a sample html
file.
<html>
<head>
<script src="sample1.js"></script>
</head>
<body>
<iframe id="sif" src="if.html"></iframe>
</body>
</html>
how can add text or elements in the if.html
with sample1.js
?
i have a sample html
file.
<html>
<head>
<script src="sample1.js"></script>
</head>
<body>
<iframe id="sif" src="if.html"></iframe>
</body>
</html>
how can add text or elements in the if.html
with sample1.js
?
thanks kingdamian42.
yes its work.
sample1.js
function getFrameContents()
{
var iFrame = document.getElementById('sif');
var iFrameBody;
if ( iFrame.contentDocument )
{ // FF
iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0];
}
else if ( iFrame.contentWindow )
{ // IE
iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];
}
alert(iFrameBody.innerHTML);
}