![]() |
#2
冰镇柠檬汁儿2010-12-01 21:03
|

//保存为information.htm作为框架引用
<html>
<head><title>应用history对象</title>
<script language="javascript">
function changeHref()
{
var urlValue=window.parent.frames[0].document.test.URLValue.value;
window.parent.frames[1].location.href=urlValue;
}
function goTo()
{
var urlValue=window.parent.frames[0].document.test.URLValue.value;
window.parent.history.go(urlValue);
}
</script>
<body>
<form name="test" onSubmit="goTo();return false">
<h3>应用history对象</h3>
<font size="2">URL地址</font>
<input type="text" name="URLValue">
<input type="button" name="htef1" value="更改href属性值" onClick="changeHref()">
<input type="button" name="go1" value="跳转到(go方法)" onClick="goTo()">
</form>
</body>
</html>
下面是个框架:
<html>
<head><title></title></head>
<frameset rows="20%,*">
<frame src=information.htm>
<frame>
</frameset>
</html>
提问:为什么我输入“网址”或“数值”时onclick=“goTO()"没反应
<html>
<head><title>应用history对象</title>
<script language="javascript">
function changeHref()
{
var urlValue=window.parent.frames[0].document.test.URLValue.value;
window.parent.frames[1].location.href=urlValue;
}
function goTo()
{
var urlValue=window.parent.frames[0].document.test.URLValue.value;
window.parent.history.go(urlValue);
}
</script>
<body>
<form name="test" onSubmit="goTo();return false">
<h3>应用history对象</h3>
<font size="2">URL地址</font>
<input type="text" name="URLValue">
<input type="button" name="htef1" value="更改href属性值" onClick="changeHref()">
<input type="button" name="go1" value="跳转到(go方法)" onClick="goTo()">
</form>
</body>
</html>
下面是个框架:
<html>
<head><title></title></head>
<frameset rows="20%,*">
<frame src=information.htm>
<frame>
</frameset>
</html>
提问:为什么我输入“网址”或“数值”时onclick=“goTO()"没反应