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()就是匿名函数表达 ...
随机推荐
- Codeforces Round #359 (Div. 2) B. Little Robber Girl's Zoo 水题
B. Little Robber Girl's Zoo 题目连接: http://www.codeforces.com/contest/686/problem/B Description Little ...
- BZOJ 1854: [Scoi2010]游戏 并查集
1854: [Scoi2010]游戏 Time Limit: 5 Sec Memory Limit: 162 MBSubmit: 2672 Solved: 958[Submit][Status][ ...
- POJ 3061 Subsequence 尺取法,一个屌屌的O(n)算法
Subsequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9050 Accepted: 3604 Descr ...
- ROS知识(11)----同步两台机器时钟
两台机器同时运行过程中,对于ROS的tf变换,其要求两台机器的时钟要保持一致. 1.查询时间 首先通过以下命令,看两台机器时钟是否有差异.在本机上,查看远程master的机器时间: ntpdate - ...
- nginx新建nginx_fzjh.conf文件,不使用默认配置文件
worker_processes 4; events{ worker_connections 1024; } http{ server { listen 80; server_name myserve ...
- git push时提示"Everything up-to-date"
从github上git clone下的项目,添加或修改文件后,git push时出现"Everything up-to-date" , 即“一切都是最新的'. 通过 git s ...
- POJ 1470 Closest Common Ancestors (LCA,离线Tarjan算法)
Closest Common Ancestors Time Limit: 2000MS Memory Limit: 10000K Total Submissions: 13372 Accept ...
- The YubiKey -- COMPARISON OF VERSIONS
COMPARISON OF YUBIKEY VERSIONS BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NE ...
- 【docker】docker部署spring boot项目在服务器上
IDE:idea 工具:docker spring boot:2.0.1 ======================================== 简单记录一下流程,以供参考: 第一步:首先得 ...
- ConcurrentDictionary AddOrUpdate
var sessionId = a.Session.SessionID.ToString(); userDic.AddOrUpdate( authUser.UserId, sessionId, (ke ...