I have this in a javascript file to diguise the source as much as possible
$(document).ready(function () {
document.getElementById('myframe1').src = ".html";
});
and in the html
<iframe id="myframe1" width="900" height="700" src=""></iframe>
Sorry I am a bit of a notice with javascript. Any help with be great! thanks.
I have this in a javascript file to diguise the source as much as possible
$(document).ready(function () {
document.getElementById('myframe1').src = "http://www.mysite./index.html";
});
and in the html
<iframe id="myframe1" width="900" height="700" src=""></iframe>
Sorry I am a bit of a notice with javascript. Any help with be great! thanks.
Share Improve this question edited Oct 1, 2012 at 10:57 killerwhale asked Oct 1, 2012 at 10:42 killerwhalekillerwhale 231 silver badge3 bronze badges 2- 1 Are you using jQuery or plain javascript? Your code says one thing and your tagging say another. – Niklas Commented Oct 1, 2012 at 10:43
- 1 tbh I didn't know. Glad there are both options here though. – killerwhale Commented Oct 1, 2012 at 11:23
1 Answer
Reset to default 7With jQuery:
<script type="text/javascript">
$(document).ready(function () {
$("#myFrame1").attr("src", "http://www.mysite./index.html");
});
</script>
With plain javascript:
<script type="text/javascript">
window.onload = init;
function init() {
document.getElementById('myframe1').src = "http://www.mysite./index.html";
}
</script>
You can add the function to the onload event like above.