jquery语法错误无法正常工作

时间:2013-06-11 07:54:21

标签: jquery jquery-plugins wordpress

大家好我正在使用jquery作为wordpress的灯箱效果弹出窗口。我尝试在Wamp服务器工作正常(localhost),但今天只有我们没有从jquery获得任何输出我检查与firebug的控制台它抛出语法错误我不知道我做错了我提供你的代码你可以检查它并告诉我我错误的地方。

<script type="text/javascript">



jQuery(document).ready(function($){

if(jQuery.cookie('popup_user_login')!='yes'){

<?php if ($_COOKIE['test']!='5') {?>

jQuery('#ptechsolfb').delay(<?php echo get_option('popup_template_delay');?>).fadeIn('medium');<?php 

   if(get_option('popup_delay_auto')=='1') { ?> function countDown(i) {

             var int = setInterval(function () {

           document.getElementById("ptechsolin").innerHTML =  "You Must Wait Until the Timer Ends " + i;



        i-- || clearInterval(int) || jQuery('#ptechsolfb').stop().fadeOut('medium') ; 

         //if i is 0, then stop the interval

    }, 1000);

}

countDown(<?php echo get_option('popup_template_count');?>);





<?php } ?> <?php if(get_option('close_esckey_ed')=='1') { ?>

     jQuery(document).bind('keydown', function(e) { 

        if (e.which == 27) {

            jQuery('#ptechsolfb').stop().fadeOut('medium')

        }

    });<?php }?><?php if(get_option('close_externel_click')=='1') {?>jQuery('#ptechsolfb').click(function(){jQuery('#ptechsolfb').stop().fadeOut('medium');<?php } ?><?php if(get_option('popup_template_close')=='1') {?> jQuery('#fbclose').click(function(){jQuery('#ptechsolfb').stop().fadeOut('medium');<?php }?><?php } ?>})     }jQuery.cookie('popup_user_login','yes',{path:'/',expires:<?php echo (get_option('popup_plugin_template_cookies')); ?>})

});
</script>

这是我在firebug控制台中看到的屏幕截图。 Error in Javascript

这是为什么jQuery没有正确加载的问题。任何建议都会受到很多赞赏。

这是Working Site Example 谢谢, 维基

NetBeans Error

 jQuery(document).ready(function($){

    if (jQuery.cookie('popup_user_login') != 'yes'){



    jQuery('#ptechsolfb').delay(100).fadeIn('medium');
            function countDown(i) {

            var int = setInterval(function () {

            document.getElementById("ptechsolin").innerHTML = "You Must Wait Until the Timer Ends " + i;
                    i-- || clearInterval(int) || jQuery('#ptechsolfb').stop().fadeOut('medium');
                    //if i is 0, then stop the interval

            }, 1000);
                    }

    countDown(25);
            jQuery(document).bind('keydown', function(e) {

    if (e.which == 27) {

    jQuery('#ptechsolfb').stop().fadeOut('medium');
    }

    });
            jQuery('#ptechsolfb').click(function(){jQuery('#ptechsolfb').stop().fadeOut('medium'); }); jQuery('#fbclose').click(function(){jQuery('#ptechsolfb').stop().fadeOut('medium'); });jQuery.cookie('popup_user_login', 'yes', {path:'/', expires:0})

    });
});

1 个答案:

答案 0 :(得分:0)

老兄,你真的错过了一个“});”。

第二行中打开的“{”的关闭位置

jQuery(document).ready(function($){

干杯......:P

相关问题