仿ie警告 Firefox火狐浏览器顶部推荐安装!
1。 复制以下代码保存为 XXX.jsvar hasIE_phone_home = 0;
// This function does the actual browser detection
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
function hasIE_hasIE() {
var ua = navigator.userAgent.toLowerCase();
return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
(ua.indexOf('webtv') == -1) &&
(location.href.indexOf('seenIEPage') == -1));
}
function hasIE_showOnlyLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer);
}
else if (document.all)
{
var style2 = document.all;
}
else if (document.layers)
{
var style2 = document.layers;
}
var body = document.getElementsByTagName('body');
body.innerHTML = style2.innerHTML;
}
function hasIE_showLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
var style2 = document.all.style;
style2.display = "block";
}
else if (document.layers)
{
var style2 = document.layers.style;
style2.display = "block";
}
}
function hasIE_moveAd(adid) {
if (document.getElementById)
{
var ad = document.getElementById('hasIE_ad');
var adloc = document.getElementById(adid);
}
else if (document.all)
{
var ad = document.all['hasIE_ad'];
var adloc = document.all;
}
else if (document.layers)
{
var ad = document.layers['hasIE_ad'];
var adloc = document.layers;
}
adloc.innerHTML = ad.innerHTML;
}
// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
if (hasIE_hasIE()) {
hasIE_showLayer("hasIE_level1");
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage1');
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage0');
}
}
function hasIE_phoneHome(image) {
if (document.getElementById)
{
var img = document.getElementById(image);
}
else if (document.all)
{
var img = document.all;
}
else if (document.layers)
{
var img = document.layers;
}
img.setAttribute('src','http://111#11.com/ping.php?host='+location.host);
}
function hasIE_ContinueWithoutFF() {
if (location.href.indexOf('?') != -1)
location.href += '&seenIEPage=1';
else
location.href += '?seenIEPage=1';
}
function closediv(i) {
writeCookie("status","showed24",240);
document.getElementById(i).style.display='none';
}
document.write("<div id=\"hasIE_level1\" style=\"background:#fcf8bd; text-align: center; padding:2px 0 3px; display:none; border-bottom:1px solid #ffd532;position:absolute; top:0; left:0; width:100%; z-index:100\"><div id=\"iewarning\" style=\"width:19px; float:left;\"><img align=\"absmiddle\" src=\"js/warning.gif\" border=\"0\" /></div><div id=\"closeimg\" style=\"width:19px; float:right;\"><a href=\"javascript:closediv('hasIE_level1');\" title=\"关闭提示\"><img src=\"js/closetop.gif\" align=\"absmiddle\" border=\"0\" /></a></div><div style=\" margin-top:4px;marign-left:4px;font-size:12px;color:#092E20\">系统检测发现您正在使用极低版本IE浏览器,可能存在各种安全隐患,强烈推荐您在windows操作系统使用更快速!更安全!更稳定!的浏览器: <a href=\"ad/Firefox.htm\" title=\"FireFox火狐浏览器2.0下载\" target=\"_blank\"><font color=\"#ee0000\">FireFox火狐浏览器,点击下载</a></font>< /div></div><div style=\"clear:both\"></div>");
if(readCookie("status") != "showed24"){
hasIE_hideAndShow();
}
2。在网页 </head>前加上
<script language="javascript" src="/XXX.js"></script>
感谢,这个用起来挺拉风的:lol 据说现在用这个方法GG会K了。 感谢老大无私奉献 这东西挺喜欢,呵呵,谢谢了 已经有代码了,不过不敢这么去做 很好,很强大,呵呵,我喜欢
页:
[1]