简单问题送50分。来者有分了。

fightplane 2004-07-02 05:04:46
这是一段表单提交。





<html>
<head>
<title>
Welcome to Wroxton-on-Sea Tourism Authority
</title>
</head>
<body>
<center>
<table height="100%" width="100%" cellpadding="0" cellspacing="0">
<tr height="50" bgcolor="#cccccc">
<td valign="center" align="center" colspan="3">
<h1><i>Wroxton=onSea Tourism Authority</i></h1>
</td>
</tr>
<tr>
<td width="15%" bgcolor="#cccccc" align="right" valign="top">


<br/>
<br/>
<a href="home.do">Home</a>
 
<br/>
<a href="registerAttraction.jsp">Register</a>
 
<br/>

<a href="editAttraction.do">logon</a>
 
<br/>



</td>
<td valign="top" align="content" />




<br/>

<br/>
<table cellpadding="2">
<form name="attractionForm" method="POST" action="/begjsp-ch13/registerAttraction.do">
<tr>
<td align="right">
<b>User ID:</b>
</td>
<td>
<input type="text" name="userId" size="15" value="">
</td>
<td align="right">
<b>Password:</b>
</td>
<td>
<input type="password" name="password" size="15" value="">
</td>
</tr>
<tr>
<td align="right">
<b>Name:</b>
</td>
<td>
<input type="text" name="name" size="30" value="">
</td>
<td align="right">
<b>Web Site:</b>
</td>
<td>
<input type="text" name="webSite" size="30" value="">
</td>
</tr>
<td align="right" valign="top">
<b>Description:</b>
</td>
<td>
<textarea name="description" cols="20" rows="3"></textarea>
</td>
<td align="right" valign="top">
<b>Address:</b>
</td>
<td>
<textarea name="address" cols="20" rows="3"></textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<input type="submit" name="submit" value="Register attraction">
</td>
</tr>
</form>
<script language="JavaScript" type="text/javascript">
<!--
document.forms["attractionForm"].elements["userId"].focus()
// -->
</script>

</table>
</td>
</tr>
<tr height="10%" bgcolor="#cccccc">
<td valign="center" align="center colspan="3">

</td>
</tr>
</table>
</center>
</body>
</html>

--------------------------------------------------------------------------
其中下面这段javascript代码的意义是什么?

<script language="JavaScript" type="text/javascript">
<!--
document.forms["attractionForm"].elements["userId"].focus()
// -->
</script>
...全文
158 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
lonkil 2004-07-13
  • 打赏
  • 举报
回复
document.attractionForm.userId.focus();也一样!
pll37 2004-07-13
  • 打赏
  • 举报
回复
焦点就是当前鼠标光标所在的位置。
daby 2004-07-06
  • 打赏
  • 举报
回复
来晚了。
tt007 2004-07-06
  • 打赏
  • 举报
回复
yaotou 2004-07-06
  • 打赏
  • 举报
回复
焦点就是鼠标
fightplane 2004-07-06
  • 打赏
  • 举报
回复
没人能解释一下焦点么?
fightplane 2004-07-05
  • 打赏
  • 举报
回复
最后我还想问一句,焦点是什么意思?
谁能解释一下焦点的概念?
wwweasy 2004-07-04
  • 打赏
  • 举报
回复
顶!!!!
yellowstrong 2004-07-04
  • 打赏
  • 举报
回复
送分的,难道我能不来吗?
朋友别哭 2004-07-04
  • 打赏
  • 举报
回复
pengxuan 2004-07-03
  • 打赏
  • 举报
回复
已经够清楚了吧
pengxuan 2004-07-03
  • 打赏
  • 举报
回复
document.forms["attractionForm"] 是对form的一个引用.
document.forms["attractionForm"].elements 是对form中所有元素的一个数组
document.forms["attractionForm"].elements["userId"] 是userId的一个引用
document.forms["attractionForm"].elements["userId"].focus() 使元素获得焦点
woyingjie 2004-07-02
  • 打赏
  • 举报
回复
<input type="text" name="userId" size="15" value="">

就是让这个文本框获得焦点
treeClimber 2004-07-02
  • 打赏
  • 举报
回复
同上
pll37 2004-07-02
  • 打赏
  • 举报
回复
attractionForm 是该窗体的名称即 <form name="attractionForm">

userId 为该窗体上某一控件的Id 号 或者name ,他作为窗体控件的唯一标识

focus()方法,用来设置该控件得到焦点,即鼠标停放的位置。
wcqgm 2004-07-02
  • 打赏
  • 举报
回复
同上

attractionForm.userId.focus();
herogao 2004-07-02
  • 打赏
  • 举报
回复
同上上上~!
yellowstrong 2004-07-02
  • 打赏
  • 举报
回复
同上上!
liberationxin 2004-07-02
  • 打赏
  • 举报
回复
同上
LxcJie 2004-07-02
  • 打赏
  • 举报
回复
在名字为attractionForm的form中找到名称为userId的控件,然后把焦点移向它

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧