Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 弹出窗口不显示';不在实时主机上工作,但在本地主机上工作_Javascript_Jquery_Popup - Fatal编程技术网

Javascript 弹出窗口不显示';不在实时主机上工作,但在本地主机上工作

Javascript 弹出窗口不显示';不在实时主机上工作,但在本地主机上工作,javascript,jquery,popup,Javascript,Jquery,Popup,我创建了一个弹出窗口,只有我的网站中的第一个访问者才能看到。它实际上在本地主机上工作得很好,但在实时主机上不工作。这个问题会有什么问题?任何人都可以帮我解决这个问题。这对我来说非常重要,因为我不能只为这个问题发布我的网站 index.html <html> <head> <style> body { margin-top: 0; } #container { max-width: 1000px; margin: 0 auto; b

我创建了一个弹出窗口,只有我的网站中的第一个访问者才能看到。它实际上在本地主机上工作得很好,但在实时主机上不工作。这个问题会有什么问题?任何人都可以帮我解决这个问题。这对我来说非常重要,因为我不能只为这个问题发布我的网站

index.html

<html>
<head>
        <style>
body { margin-top: 0; }

#container {
  max-width: 1000px;
  margin: 0 auto;
  background: #EEE;
}

h1,
p { padding: 1em 1em; }

#fvpp-blackout {
  display: none;
  z-index: 499;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: #000;
  opacity: 0.5;
}

#my-welcome-message {
  display: none;
  z-index: 500;
  position: fixed;
  width: 36%;
  left: 30%;
  top: 20%;
  padding: 20px 2%;
  font-family: Calibri, Arial, sans-serif;
  background: #FFF;
}

#fvpp-close {
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
}

#fvpp-dialog h2 {
  font-size: 2em;
  margin: 0;
}

#fvpp-dialog p { margin: 0; }
</style>
        </head>

        <body>
<div id="my-welcome-message">
          <h2>Welcome to my site</h2>
          <p>Hello, welcome to my website.</p>
        </div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
<script src="jquery.firstVisitPopup.js"></script> 
<script>
            $(function () {
                $('#my-welcome-message').firstVisitPopup({
                    cookieName : 'homepage',
                    showAgainSelector: '#show-message'
                });
            });
        </script><script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-36251023-1']);
  _gaq.push(['_setDomainName', 'jqueryscript.net']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>
</html>

正文{页边距顶部:0;}
#容器{
最大宽度:1000px;
保证金:0自动;
背景:#EEE;
}
h1,
p{padding:1em 1em;}
#fvpp断电{
显示:无;
z指数:499;
位置:固定;
宽度:100%;
身高:100%;
排名:0;
左:0;
背景:#000;
不透明度:0.5;
}
#我的欢迎辞{
显示:无;
z指数:500;
位置:固定;
宽度:36%;
左:30%;
最高:20%;
填充:20px2%;
字体系列:Calibri、Arial、无衬线字体;
背景:#FFF;
}
#FVP关闭{
位置:绝对位置;
顶部:10px;
右:20px;
光标:指针;
}
#fvpp对话框h2{
字号:2em;
保证金:0;
}
#fvpp对话框p{margin:0;}
欢迎来到我的网站
你好,欢迎来到我的网站

$(函数(){ $(“#我的欢迎词”)。FirstVisitOpup({ cookieName:“主页”, showAgainSelector:“#显示消息” }); }); var _gaq=_gaq | |[]; _gaq.push([''设置帐户','UA-36251023-1']); _gaq.push([''u setDomainName','jqueryscript.net']); _gaq.push([''u trackPageview']); (功能(){ var ga=document.createElement('script');ga.type='text/javascript';ga.async=true; ga.src=('https:'==document.location.protocol?'https://ssl' : 'http://www“)+”.google analytics.com/ga.js'; var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s); })();
jquery.firstvisitpoup.js

(function ($) {

    'use strict';

    $.fn.firstVisitPopup = function (settings) {

        var $body = $('body');
        var $dialog = $(this);
        var $blackout;
        var setCookie = function (name, value) {
            var date = new Date(),
                expires = 'expires=';
            date.setTime(date.getTime() + 31536000000);
            expires += date.toGMTString();
            document.cookie = name + '=' + value + '; ' + expires + '; path=/';
        }
        var getCookie = function (name) {
            var allCookies = document.cookie.split(';'),
                cookieCounter = 0,
                currentCookie = '';
            for (cookieCounter = 0; cookieCounter < allCookies.length; cookieCounter++) {
                currentCookie = allCookies[cookieCounter];
                while (currentCookie.charAt(0) === ' ') {
                    currentCookie = currentCookie.substring(1, currentCookie.length);
                }
                if (currentCookie.indexOf(name + '=') === 0) {
                    return currentCookie.substring(name.length + 1, currentCookie.length);
                }
            }
            return false;
        }
        var showMessage = function () {
            $blackout.show();
            $dialog.show();
        }
        var hideMessage = function () {
            $blackout.hide();
            $dialog.hide();
            setCookie('fvpp' + settings.cookieName, 'true');
        }

        $body.append('<div id="fvpp-blackout"></div>');
        $dialog.append('<a id="fvpp-close">&#10006;</a>');
        $blackout = $('#fvpp-blackout');

        if (getCookie('fvpp' + settings.cookieName)) {
            hideMessage();
        } else {
            showMessage();
        }

        $(settings.showAgainSelector).on('click', showMessage);
        $body.on('click', '#fvpp-blackout, #fvpp-close', hideMessage);

    };

})(jQuery);
(函数($){
"严格使用",;
$.fn.firstvisitpoup=函数(设置){
变量$body=$('body');
变量$dialog=$(此);
var$停电;
var setCookie=函数(名称、值){
变量日期=新日期(),
expires='expires=';
date.setTime(date.getTime()+31536000000);
expires+=date.togmString();
document.cookie=name+'='+value+';“+expires+';path=/”;
}
var getCookie=函数(名称){
var allCookies=document.cookie.split(“;”),
cookieCounter=0,
currentCookie='';
for(cookieCounter=0;cookieCounter
jquery.firstvisitpoup.min.js

! function(e) {
    "use strict";
    e.fn.firstVisitPopup = function(t) {
        var i, o = e("body"),
            n = e(this),
            c = function(e, t) {
                var i = new Date,
                    o = "expires=";
                i.setTime(i.getTime() + 31536e6), o += i.toGMTString(), document.cookie = e + "=" + t + "; " + o + "; path=/"
            },
            p = function(e) {
                var t = document.cookie.split(";"),
                    i = 0,
                    o = "";
                for (i = 0; i < t.length; i++) {
                    for (o = t[i];
                        " " === o.charAt(0);) o = o.substring(1, o.length);
                    if (0 === o.indexOf(e + "=")) return o.substring(e.length + 1, o.length)
                }
                return !1
            },
            f = function() {
                i.show(), n.show()
            },
            r = function() {
                i.hide(), n.hide(), c("fvpp" + t.cookieName, "true")
            };
        o.append('<div id="fvpp-blackout"></div>'), n.append('<a id="fvpp-close">&#10006;</a>'), i = e("#fvpp-blackout"), p("fvpp" + t.cookieName) ? r() : f(), e(t.showAgainSelector).on("click", f), o.on("click", "#fvpp-blackout, #fvpp-close", r)
    }
}(jQuery);
!职能(e){
“严格使用”;
e、 fn.firstVisitPopup=函数(t){
变量i,o=e(“主体”),
n=e(这个),
c=函数(e,t){
var i=新日期,
o=“expires=”;
i、 setTime(i.getTime()+31536e6),o+=i.togmString(),document.cookie=e+“=”+t+”;“+o+”;path=/”
},
p=函数(e){
var t=document.cookie.split(“;”),
i=0,
o=“”;
对于(i=0;i
请任何人帮助我解决这个问题