关于 js跳转 的一些整理..
来源:互联网 发布:淘宝助理 又要适配 编辑:程序博客网 时间:2024/05/19 10:39
<a href="#"onclick="del(id)">删除</a>会出现不正常跳转,将#改成javascript:void(0)就可以了
#包含了一个位置信息
默认的锚点是#top 也就是网页的上端
而javascript:void(0) 仅仅表示一个死链接
这就是为什么有的时候页面很长浏览链接明明是#可是
跳动到了页首
而javascript:void(0) 则不是如此
所以调用脚本的时候最好用void(0)或者<input onclick>、<div onclick>等
Button链接,代码如下:
1.链接到某页
<input type="button" name="Submit" value="确 定" class="btn" onclick="location.href='filename.html'" />
2.返回(等同后退)
<input name="Submit2" type="button" class="btn" onclick="location.href='javascript:history.go(-1);'" value="返 回" />
3.打开新网页
<input type="button" name="Submit2" value="确 定" class="btn" onclick="window.open('filename.html')" />
4.打开无边框的新窗口
<input type="button" name="Submit2" value="确 定" class="btn" onclick="javascript:window.open('filename.html','','width=720,height=500,resizable=yes,scrollbars=yes,status=no')" />
5.打开新网页同时指向另一页
<input type="button" name="Submit2" value="确 定" class="btn" onclick="window.open('filename.html');location.href='http://hi.baidu.com/harryxue'" />
6.打开无边框的新窗口同时指向另一页
<input type="button" name="Submit2" value="确 定" class="btn" onclick="javascript:window.open('http://hi.baidu.com/harryxue','','width=720,height=500,resizable=yes,scrollbars=yes,status=no'); window.location='filename.html';" />
7.点击按钮弹出确认alert窗口
方式一:
<input type="button" name="Submit1" value="确定" class="btn"
onClick="alert('是否确认提交?');location.href= 'filename.html';return false;" >
方式二:
<input type="button" name="Submit2" value="确定" class="btn"
onClick="if (confirm('是否确认提交?'))location.href= 'filename.html';return false;" >
===========================
<input type=button value=刷新 onclick="window.location.reload()">
<input type=button value=前进 onclick="window.history.go(1)">
<input type=button value=后退 onclick="window.history.go(-1)">
<input type=button value=前进 onclick="window.history.forward()">
<input type=button value=后退 onclick="window.history.back()">
- 关于 js跳转 的一些整理..
- 关于JS的一些问题--要整理
- 关于js跳转的总结
- js(javascript)的跳转代码整理
- js方式的页面跳转常用整理
- 关于CVS的一些整理
- 关于ttServer的一些整理
- 一些关于虚拟机的整理
- 关于NavigationController的一些整理
- 关于initrd的一些整理
- 关于排序的一些整理
- 关于null的一些整理
- 关于CMUSphinx的一些整理
- 关于Shadowsocks的一些整理
- 关于中断的一些整理
- 关于字符串的一些整理
- js页面跳转整理
- js页面跳转整理
- u-boot中mkimage工具的具体使用
- 利用CImage完成图片的显示、拷贝、绘制及转换图片格式
- symbian 活动对象理解
- 用CTime类得到当前日期、时间、星期,格式化
- Unicode码和ASCII码的详细解释
- 关于 js跳转 的一些整理..
- LINUX C 定时器
- 有效的记忆与学习
- HTML表格在IE中值为空时不显示表格边框的解决方法
- VS 2010 发布活动资料
- .NET发送邮件
- facade层,service 层,domain层,dao 层设计
- Html表格设置
- java中使用scoket模拟http post请求发送图片或文件