感谢您查看我的问题。所以,我对iframe有疑问。我想要一个几乎像实际浏览器的iframe。我需要让它至少有一个前进按钮,一个后退按钮和一个URL加载器。我已经完成了这项工作,但效果不佳。 我的代码:
<html>
<head>
<title> iFrame </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
$('.frmSubmit').click(function(e)
{
$('#myIframe').attr('src', $('.frmUrlVal').attr('value'));
e.preventDefault();
});
});
</script>
</head>
<body>
<form>
<input type="text" value="http://"class="frmUrlVal">
<input type="submit" class="frmSubmit" value="Go">
<input type="button" VALUE="< < Back " onClick="myIframe.history.back()">
<input type="button" VALUE="Forward > >" onClick="myIframe.history.forward()">
</form>
<iframe align="center" width="50%" height="50%" src="http://gravitate.webs.com" frameborder=yes scrolling="yes" name="myIframe" id="myIframe"> </iframe>
<form>
还会提供重新加载/取消按钮。甚至可能是状态栏。谢谢!
答案 0 :(得分:3)
<html>
<head>
<title> iFrame </title>
<script language="javascript">
function LoadPage(){
var objFrame=document.getElementById("myIframe");
objFrame.src=document.getElementById("URL").value;
}
</script>
</head>
<body>
<div style="Clear:both;">
<input type="text" value="http://amazon.co.uk" class="frmUrlVal" ID="URL">
<input type="submit" class="frmSubmit" value="Go" onclick="LoadPage()">
<input type="button" VALUE="< < Back " onClick="myIframe.history.back()">
<input type="button" VALUE="Forward > >" onClick="myIframe.history.forward()">
</div>
<iframe align="center" width="100%" height="90%" src="http://amazon.co.uk" frameborder=yes scrolling="yes" name="myIframe" id="myIframe"> </iframe>
</body>
</html>