JavaScript 之 日常积累
1. <a>标签"加入收藏",兼容IE,FireFox等
function bookmarksite() {
if (window.sidebar) {
// Mozilla Firefox Bookmark
window.sidebar.addPanel(document.title, window.location.href, '');
}
else if (window.external && ('AddFavorite' in window.external)) {
// IE Favorite
window.external.AddFavorite(location.href, document.title);
} else if (window.opera && window.print) {
// Opera Hotlist
this.title = document.title;
return true;
} else {
// webkit - safari/chrome
alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
}
}
//加入收藏
function bookmarksite(title, url) {
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else
if (window.opera && window.print) { // opera
var elem = document.createElement('a');
elem.setAttribute('href', url);
elem.setAttribute('title', title);
elem.setAttribute('rel', 'sidebar');
elem.click();
}
else
if (document.all)// ie
window.external.AddFavorite(url, title);
}
2、刷新页面避免重新发送
//用下面替换 document.location.reload();
location.href = location.href;
若为cs后台:在执行的方法尾部添加一条重载页面既可。
Response.Redirect(Request.Url.ToString());
JavaScript 之 日常积累的更多相关文章
- javascript 技巧总结积累(正在积累中)
1.文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当输入获得焦点后,产生该文件 Onchange:当文字值改变时,产生该事件 Onselect:当文字加亮后,产生该文件 & ...
- 来自平时工作中的javascript知识的积累---持续补充中
① SeaJs和RequireJS最大的区别 解惑:来自豆友 ② javascript中如何判断undefined var exp = undefined; if (exp === undefined ...
- Android 开发日常积累
Android 集合 Android 开源项目分类汇总 扔物线的 HenCoder 高级 Android 教程 hencoder HenCoder:给高级 Android 工程师的进阶手册 Andro ...
- javascript的日常代码
1. 直接输出文字: document.write("<显示的类型>显示文字</类型>"); <script>document.writ ...
- Python 日常积累
包管理 >from ... import ... 的用法和直接import的区别 直接使用import时,如果需要使用到导入模块内的属性和方法,必须使用模块名.属性和模块名.方法的方式进行调用 ...
- 日常积累oracle 有关信息
对于VARCHAR2类型,我们在内存使用和效率上需要做出一个权衡.对于VARCHAR2(长度>=2000)变量,PL/SQL动态分配内存来存放实际值,但对于VARCHAR2(长度<2000 ...
- 日常积累之JSON.stringify和JSON.parse substr
1.substr(start,len) 从字符串中读取内容,第一个参数是读取的首位置,如果为负数,则从末尾倒数计数. 第二个参数是要读取的长度. eg: var str = "silence ...
- javascript之小积累-获取url传参的值
在项目中经常遇到两个页面传值的情况,我采取的方案是通过url后面加参数,也就是get方式传值. 这个方式的优点是:传值.获取很方便. 缺点是:1. 把参数都暴露在浏览器中了,一些敏感信息不建议这样传: ...
- javascript之小积累-匿名函数表达式的最佳实践
在写js的时候,还是经常会用的匿名函数表达式,比如 setTimeout(function() { console.log(110); }, 1000); 上面那个function()就是匿名函数表达 ...
随机推荐
- Educational Codeforces Round 13 E. Another Sith Tournament 状压dp
E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...
- java中write(byte[] b)与write(byte[] b,int off,int len)区别
public static void copyInputStreamT0OutputStream(InputStream in, OutputStream out) { byte[] buffer = ...
- SpringBoot读取配置properties配置文件
见:http://www.cnblogs.com/VergiLyn/p/6286507.html
- NGINX 如何防盗链
一.安装Nginx: 1.解决依赖关系 # yum groupinstall "Development Tools" "Server Platform Deveopmen ...
- Java_JSP自定义标签的开发与应用
在JSTL提供了四个标签库(核心标签库.国际化标签库.数据库标签库和XML标签库),涉及到了几十个标签.虽然这些标签可以完成比较复杂的工作,但它们仍然无法满足程序中的特殊需求.因此,就需要用户根据自己 ...
- ASP.NET MVC中的Session以及处理方式
最近在ASP.NET MVC项目中碰到这样的情况:在一个controller中设置了Session,但在另一个controller的构造函数中无法获取该Session,会报"System.N ...
- memcached-session-manager配置
原文地址: http://chenzhou123520.iteye.com/blog/1650212 声明:本篇文章是根据memcached-session-manager官方配置方法wiki页面翻译 ...
- 【docker-compose】docker-compose.yml文本内容详解 + docker-compose命令详解 + docker-compose启动服务容器时区设置
参考地址:https://blog.csdn.net/Kiloveyousmile/article/details/79830810 参考地址:https://docs.docker.com/comp ...
- Li的前期工作Level_Set_Evolution_Without_Re-initialization_A_New_Variational_Formulation
注意:因为页面显示原因.里头的公式没能做到完美显示,有须要的朋友请到我的资源中下载 无需进行又一次初始化的水平集演化:一个新的变分公式 Chunming Li , Chenyang Xu , Chan ...
- 构建一个高可扩展性javabean和jsp连接数据库操作
1. 我们先在Tomcat 中创建一个DataSource- jdbc/Panabia,然后再创建一个java“基类”,这个类封装了数据库连接和连接的释放. package Panabia.db; i ...