Answers for "js get iframe attributes"

4

iframe getelementbyid

document.getElementById('myframe1').contentWindow.document.getElementById('x')
Posted by: Guest on June-12-2020
1

js set iframe src

<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>
Posted by: Guest on February-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language