| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 297 人关注过本帖
标题:这段代码中不明白的地方
只看楼主 加入收藏
wangsj_2001
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2012-1-26
结帖率:0
收藏
 问题点数:0 回复次数:0 
这段代码中不明白的地方
大家好,本人刚学习JavaScript,从网上下载了一份文档,里面有很多错误,改了很多地方。下面的代码也是如此,也不知道改的对不对。也有不明白的地方,我列出了三点:
1. frames[1],form[0],goParam[1]都代表什么意思呀,为什么后面都要加上[0]或者[1]呢?
2. 代码里的 parent.frames[1].history.go(goVal) 不明白在这里是什么意思
3. 下面的代码里面不知道还有多少错误,我调试了一下,没找到错误,还请各位高手指教,谢谢。

<html>
<head>
<title>History对象</title>
</head>
<body bgcolor="#FFFFFF">
<SCRIPT LANGUAGE="JavaScript">
<!--
function goPrev(){
parent.frames[1].history.back()
}
function goNext(){
parent.frames[1].history.forward()
}
function moveOn(){
var urlAddress = ""
urlAddress = document.forms[0].LocationBox.value
if (urlAddress != ""){
parent.frames[1].location = urlAddress
document.forms[0].ListLen.value = parent.frames[1].history.length}
else{
alert("请在单击按钮之前输入文本信息.")
}
}
function jump(){
if (document.forms[0].goParam[1].checked){
var goVal = 0
goVal = parseInt(document.forms[0].GoBox.value)}
else{
var goVal = ""
goVal = document.forms[0].GoBox.value
parent.frames[1].history.go(goVal)
}
}
function getParentInfo(){
myParentTitle = parent.document.title
alert("myParentTitle")
}
// -->
</SCRIPT>
<form method="POST">
<h3><em>Ways to navigate</em></h3>
<ul>
<li>使用location对象.</li>
</ul>
<p><input type="text" size="20" maxlength="50" name="LocationBox"> <input type="button" value="查找" onClick="moveOn()"></p>
<ul>
<li>使用history对象的<em>back()</em> and<em> forward() </em>方法:</li>
</ul>
<p align=center><input type="button" value="&lt;&lt;" onClick="goPrev()"> <input type="button" value="&gt;&gt;" onClick="goNext()"></p>
<ul>
<li>使用history对象的<em>go()</em>方法:</li>
</ul>
<blockquote>
<p><input type="radio" name="goParam" value="ByCount">By Count <input type="radio" name="goParam" value="ByName">By Name <input type="text" size="20" maxlength="30" name="GoBox"></p>
<p><input type="button" value="Go" onClick="jump()"> History列表: <input type="text" size="3" maxlength="4" name="ListLen"> </p>
</blockquote>
<input type="button" value="取得信息" onClick="getParentInfo()">
</form>
</body>
</html>
搜索更多相关主题的帖子: head html title 
2012-04-07 00:12
快速回复:这段代码中不明白的地方
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032845 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved