我把它放在一个javascript文件中,以便尽可能多地混淆源代码。
$(document).ready(function () {
document.getElementById('myframe1').src = "http://www.mysite.com/index.html";
});
和在html中
<iframe id="myframe1" width="900" height="700" src=""></iframe>
对不起,我对javascript有一点注意。任何帮助都是伟大的!谢谢。
发布于 2012-10-01 18:46:41
使用jQuery:
<script type="text/javascript">
$(document).ready(function () {
$("#myFrame1").attr("src", "http://www.mysite.com/index.html");
});
</script>
使用纯javascript:
<script type="text/javascript">
window.onload = init;
function init() {
document.getElementById('myframe1').src = "http://www.mysite.com/index.html";
}
</script>
您可以像上面那样将该函数添加到onload事件中。
https://stackoverflow.com/questions/12671735
复制相似问题