I have created a iframe dynamicaly and added a src attribute to it. Then i have appended this iframe to body of the page. Know i want to attach an onload event to iframe to read the iframe content. Can somebody suggest how do i do that.
frame = document.createElement('iframe');
frame.setAttribute('src','http://myurl.com');
body.appendChild(frame);
frame.onload = function(){
alert('hi'); // here i want to read the content in the frame.
}