I have a program which will dynamically set an iframe src to load pages. I need to hook a event handler for the page completely loaded. How can i do it? Thanks!
To change the iframe src attribute, we will be using a select drop down menu, and a button element to activate the function that will change the src attribute. Note that this is only for example purposes, instead of using onClick you may want to consider using event handlers in an external script.
You can use the following to change the src attribute of the iFrame: $("#content"). attr('src', 'http://mysite.com/newpage.html');
You can embed an iframe in a page that is inside another iframe on another web page. When you set the target attribute to _parent, the link will open in the web page that is holding the iframe. In most situations with iframes, this target will open links in the same way that the _parent target does.
Definition and Usage. The src property sets or returns the value of the src attribute in an iframe element. The src attribute specifies the URL of the document to show in an iframe.
To change the iframe src attribute, we will be using a select drop down menu, and a button element to activate the function that will change the src attribute.
Try this: add a hidden input field (with runat="server" attribute) and change it's value to your IFrame's src in the JavaScript. That way, you'll be able to read the field's value server-side.
In this first we will create a new asp.net application and add a web page. In this webpage we will add and iframe and add server tag which Is runat=”server”. Please check the above code above highlighted piece of code. Now this iframe control is accessible on server side code of your application. Now add a new page which we will display in iframe.
<script type="text/javascript"> function iframeDidLoad() { alert('Done'); } function newSite() { var sites = ['http://getprismatic.com', 'http://gizmodo.com/', 'http://lifehacker.com/'] document.getElementById('myIframe').src = sites[Math.floor(Math.random() * sites.length)]; } </script> <input type="button" value="Change site" onClick="newSite()" /> <iframe id="myIframe" src="http://getprismatic.com/" onLoad="iframeDidLoad();"></iframe>
Example at http://jsfiddle.net/MALuP/
Try this:
top.document.getElementById('AppFrame').setAttribute("src",fullPath);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With