js 多种方法
是否显示滚动条 <html> <frameset id="myFrameset" cols="50%,50%"> <frame id="leftFrame" src="frame_a_scrolling.htm"> <frame id="rightFrame" src="frame_a.htm"> </frameset> </html> <html> <head> [removed] function enableScrolling() { parent.document.getElementById("leftFrame").scrolling="yes" parent.document.getElementById("rightFrame").scrolling="yes" } function disableScrolling() { parent.document.getElementById("leftFrame").scrolling="no" parent.document.getElementById("rightFrame").scrolling="no" } [removed] </head> <body bgcolor="#EFE7D6"> <form> <input type="button" value="Scroll bars"> <input type="button" value="No scroll bars"> </form> <p>Right-click inside the frames and select "View Source" to see the source code.</p> </body> </html>
副选框实现的功能(转换为大写)
<html>
<body>
<script type="text/javascript">
function convertField(field)
{
if (document.form1.convertUpper.checked)
{
field.value=field.value.toUpperCase()
}
}
function convertAllFields()
{
document.form1.fname.value=document.form1.fname.value.toUpperCase()
document.form1.lname.value=document.form1.lname.value.toUpperCase()
}
</script>
<form name="form1">
First name:
<input type="text" name="fname" onChange="convertField(this)" size="20" />
<br />
Last name:
<input type="text" name="lname" onChange="convertField(this)" size="20" />
<br />
<input type="checkBox" name="convertUpper" onClick="if (this.checked) {convertAllFields()}" value="ON">
</form>
</body>
</html>
文档对象
显示连接的数量
<html>
<body>
<a name="A">First anchor</a><br />
<a name="B">Second anchor</a><br />
<a name="C">Third anchor</a><br />
<br />
Number of anchors in this document:
<script type="text/javascript">
document.write(document.anchors.length)
</script>
</body>
</html>
显示当前所在服务器的地址
<html>
剩余55页未读,继续阅读
- 粉丝: 0
- 资源: 10
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助