兼容IE5+/Win, Firefox, Netscape 6+, Opera 7+, Safari, Konqueror 3, IE5/Mac, 还有 iCab 3.
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<script> <BR> //<![CDATA[ <BR> /* <BR> * Copyright 2006 Dynamic Site Solutions. <BR> * Free use of this script is permitted for non-commercial applications, <BR> * subject to the requirement that this comment block be kept and not be <BR> * altered. The data and executable parts of the script may be changed <BR> * as needed. Dynamic Site Solutions makes no warranty regarding fitness <BR> * of use or correct function of the script. Terms for use of this script <BR> * in commercial applications may be negotiated; for this, or for other <BR> * questions, contact "license-info@dynamicsitesolutions.com". <BR> * <BR> * Script by: Dynamic Site Solutions -- http://www.dynamicsitesolutions.com/ <BR> * Last Updated: 2006-08-03 <BR> */ <br><br> //IE5+/Win, Firefox, Netscape 6+, Opera 7+, Safari, Konqueror 3, IE5/Mac, iCab 3 <br><br> var addBookmarkObj = { <BR> init:function() { <BR> if(!document.getElementById || !document.createTextNode) return; <BR> var cont=document.getElementById('addBookmarkContainer'); <BR> if(!cont) return; <BR> var a=document.createElement('a'); <BR> a.href=location.href; <BR> if(!window.opera) { // this doesn't work in Opera 7+ if the link has an <BR> // onclick handler, so we only add it if the browser isn't Opera. <BR> a.onclick=function() { <BR> addBookmarkObj.exec(this.href,this.title); <BR> return false; <BR> } <BR> } <BR> a.rel='sidebar'; // this makes it work in Firefox and Opera 7+ <BR> a.title=document.title; <BR> a=cont.appendChild(a); <BR> a.appendChild(document.createTextNode('Bookmark This Page')); <BR> }, <BR> exec:function(url, title) { <BR> var isKonq=(isLikelyKonqueror3 && isLikelyKonqueror3()); <BR> var isMac=(navigator.userAgent.toLowerCase().indexOf('mac')!=-1); <BR> var buttonStr = isMac?'Command/Cmd':'CTRL'; <br><br> if(window.external && (!document.createTextNode || <BR> (typeof(window.external.AddFavorite)=='unknown'))) { <BR> // IE4/Win generates an error when you <BR> // execute "typeof(window.external.AddFavorite)" <BR> // In IE7 the page must be from web server, not directly from a local <BR> // file system, otherwise, you get a permission denied error. <BR> window.external.AddFavorite(url, title); // IE/Win <BR> } else if(isKonq) { <BR> alert('You need to press CTRL + B to bookmark our site.'); <BR> } else if((window.sidebar && <BR> (navigator.userAgent.toLowerCase().indexOf('firefox')!=-1)) || <BR> (window.opera && opera.buildNumber && !isNaN(opera.buildNumber()))) { <BR> void(0); // do nothing here (Firefox or Opera 7+) <BR> } else if(window.opera) { // older Opera <BR> alert('You need to press '+buttonStr+' + T to bookmark our site.'); <BR> } else if(window.home) { // Netscape, iCab <BR> alert('You need to press '+buttonStr+' + D to bookmark our site.'); <BR> } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0 <BR> alert('You need to press Command/Cmd + D to bookmark our site.'); <BR> } else { <BR> alert('In order to bookmark this site you need to do so manually '+ <BR> 'through your browser.'); <BR> } <BR> } <BR> } <br><br> function isLikelyKonqueror3() { <BR> if(!document.getElementById) return false; <BR> if(document.defaultCharset || window.opera || !window.print) return false; <BR> if(window.home) return false; /* Konqueror doesn't support this but Firefox, <BR> which has silent support for document.all when in Quirks Mode does */ <BR> if(document.all) return true; // Konqueror versions before 3.4 <BR> var likely = 1; <BR> // testing for silent document.all support; try-catch used to keep it from <BR> // generating errors in other browsers. <BR> // try-catch causes errors in IE4 so we use the eval() to hide it. <BR> // try { <BR> // var str=document.all[0].tagName; <BR> // } catch(err) { likely=0; } <BR> eval("try{var str=document.all[0].tagName;}catch(err){likely=0;}"); <BR> return likely; <BR> } <br><br> function dss_addEvent(el,etype,fn) { <BR> if(el.addEventListener && (!window.opera || opera.version) && <BR> (etype!='load')) { <BR> el.addEventListener(etype,fn,false); <BR> } else if(el.attachEvent) { <BR> el.attachEvent('on'+etype,fn); <BR> } else { <BR> if(typeof(fn) != "function") return; <BR> var tempFunc = el['on'+etype]; <BR> el['on'+etype] = function() { <BR> if(typeof(tempFunc) == "function") tempFunc(); <BR> fn(); <BR> } <BR> } <BR> } <br><br> dss_addEvent(window,'load',addBookmarkObj.init); <BR> //]]> <BR> </script>
cross-browser addBookmark
by www.dynamicsitesolutions.comdemonstration

JavaScript字符串替换方法详解及常见问题解答 本文将探讨两种在JavaScript中替换字符串字符的方法:在JavaScript代码内部替换和在网页HTML内部替换。 在JavaScript代码内部替换字符串 最直接的方法是使用replace()方法: str = str.replace("find","replace"); 该方法仅替换第一个匹配项。要替换所有匹配项,需使用正则表达式并添加全局标志g: str = str.replace(/fi

本教程向您展示了如何将自定义的Google搜索API集成到您的博客或网站中,提供了比标准WordPress主题搜索功能更精致的搜索体验。 令人惊讶的是简单!您将能够将搜索限制为Y

因此,在这里,您准备好了解所有称为Ajax的东西。但是,到底是什么? AJAX一词是指用于创建动态,交互式Web内容的一系列宽松的技术。 Ajax一词,最初由Jesse J创造

本文系列在2017年中期进行了最新信息和新示例。 在此JSON示例中,我们将研究如何使用JSON格式将简单值存储在文件中。 使用键值对符号,我们可以存储任何类型的

利用轻松的网页布局:8个基本插件 jQuery大大简化了网页布局。 本文重点介绍了简化该过程的八个功能强大的JQuery插件,对于手动网站创建特别有用

核心要点 JavaScript 中的 this 通常指代“拥有”该方法的对象,但具体取决于函数的调用方式。 没有当前对象时,this 指代全局对象。在 Web 浏览器中,它由 window 表示。 调用函数时,this 保持全局对象;但调用对象构造函数或其任何方法时,this 指代对象的实例。 可以使用 call()、apply() 和 bind() 等方法更改 this 的上下文。这些方法使用给定的 this 值和参数调用函数。 JavaScript 是一门优秀的编程语言。几年前,这句话可

jQuery是一个很棒的JavaScript框架。但是,与任何图书馆一样,有时有必要在引擎盖下发现发生了什么。也许是因为您正在追踪一个错误,或者只是对jQuery如何实现特定UI感到好奇

该帖子编写了有用的作弊表,参考指南,快速食谱以及用于Android,BlackBerry和iPhone应用程序开发的代码片段。 没有开发人员应该没有他们! 触摸手势参考指南(PDF) Desig的宝贵资源


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

Dreamweaver Mac版
视觉化网页开发工具

记事本++7.3.1
好用且免费的代码编辑器

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器