JAVASCRIPT(7)

本节要点:  点击事件,history(back,forworrd,go),loation.

列表的制作(table)

1.(列表的制作) thead代表表头 tr th代表列框里面的

<table id="tab" border="" cellpadding="">
			<thead>
				<tr>	
				<th>序号</th>	
				<th>姓名</th>
				<th>性别</th>
				</tr>			
			</thead>		
			<tbody>
				<tr>
					<td>1001</td>
					<td>张三</td>
					<td>男</td>
				</tr>		
				<tr>
					<td>1001</td>
					<td>李四</td>
					<td>男</td>
				</tr>		
				<tr>
					<td>1001</td>
					<td>小红</td>
					<td>女</td>
				</tr>
			</tbody>
		</table>

2.history对象

back()代表加载history列表的上一个信息

forword ()代表前进按钮

go()加载列表所要到达大页数

(例题 )页面跳转

<input type="button" name="" id="bt1" value="bacak" />
		<input type="button" name="" id="bt2" value="打开03.html" />
		<input type="button" name="" id="bt3" value="forward" />
		<input type="button" name="" id="bt4" value="go" />
		<script type="text/javascript">
			bt1.onclick=function(){
			history.back()
			}
			//进入下一个页面
			bt2.onclick=function(){
		      location.href="t4.html"
			}
			bt3.onclick=function(){
			history.forward()
			}
			bt4.onclick=function(){
			history.go(1)//相当于forword
			
			}

2.1网站的跳转

assign代表跳转到下一个页面

reload刷新

没有后退功能的跳转

例题:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="button" name="" id="bt1" value="assign" />
		<input type="button" name="" id="bt2" value="forward" />
			<input type="button" name="" id="bt2" value="replace" />
		<script type="text/javascript">
			//assign代表跳转到下一个页面
			bt1.onclick=function(){
			location.assign("https://www.cas.cn/")
			}
			//reload刷新
			bt2.onclick=function(){
			location.reload()
			}
			//没有后退功能的跳转
			bt3.onclick=function(){
			location.replace("https://www.cas.cn/")
			}
			
		</script>
	</body>
</html>

3.事件的点击

(属性方法点击)

 

onblur当窗口失去焦点时运行脚本。
onfocus当窗口获得焦点时运行脚本。
onload当文档加载之后运行脚本。
onresize当调整窗口大小时运行脚本。
onstorageWeb Storage 区域更新时(存储空间中的数据发生变化时)运行脚本

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值