I am including a frame in my html document. What I want to do is to change some text in the frame. The frame is not hosted on my website. I have a logic like this:
- let the frame to load
- Use jQuery
document.readyfunction - When the document is completely loaded,I will change the element by
document.getelementbyId("id of element")
Unfortunately this is not working. I had Googled a lot but didn’t find any suitable answer. Can anyone assist me?
Here is the frame:
<iframe src="http://www.traffic-zombie.com/en/members/referral?campaignID=1190&backgroundColor=%23ffffff&textColor=%23000000" width="650" height="1000" frameborder="0" style="border: 1px solid #ffffff;"></iframe>
Let say I want to change the word "referral" in the frame;
here is my script:
<script type="text/javascript">
$(document).ready(function() {
var c=document.getElementById('zom-status').innerHTML;
alert(c);
});
</script>
Any help will be appreciated.
It is generally not possible.
jQuery cross domain iframe scripting
You may want to consider grabbing the html for that iframe and then injecting it into the page, at least that way you will have total control. Take a look here to learn about that technique, I believe its far more likely to bear fruit:
http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/