Hi friends,
Here i had build a html page with an iframe. I had an id within the iframe src page. Is it possible to access the id from my current page.
Throu javascript.
Please help me.
Hi friends,
Here i had build a html page with an iframe. I had an id within the iframe src page. Is it possible to access the id from my current page.
Throu javascript.
Please help me.
Hi,
This is a small example I put through,
<title>Untitled Page</title>
<script type="text/javascript" >
function ShowVal() {
alert(myIframe.document.getElementById('nameText').value);
}
</script>
'myIfrmae' is the id of the iframe. and 'nameText' is a textbox control in the page contained in the iframe.
I was calling this ShowVal function from the parent page on a button click.
Thanks.
P.S. Sorry could not post the whole example. Having trouble with posting Html.
You must be careful if you are accessing an iframe's script from your parent page, to make sure that your iframe has already finished loading before requesting from it. Here is an example:
window.onload = function () {
document.getElementById('iframeId').onload = function () { //Attach an onload function to the iframe
//Do the stuff you want to do with the iframe here
//because this function is executed once the iframe has finished loading
};
};