为了账号安全,请及时绑定邮箱和手机立即绑定

为什么变量V不能作为全局变量?

   
   为什么变量V不能作为全局变量?
   
   
   <script type="text/javascript">
    	var v = $("#animation").val();
    //【显示】按钮
    $("#btnShow").click(function() {
    	if(v=="1"){
    		$('p').fadeIn();
    	}
    	else if(v=="2"){
    		$('p').fadeIn("slow");
    	}
    	else if(v=="3"){
    		$('p').fadeIn(6000);
    	}
    	else if(v=="4"){
    		$('p').fadeIn(2000,function(){
    			alert("hhhh")
    		});
    	}
    	else if(v=="5"){
    		$('p').fadeIn(1000,"linear");
    	}
    	else if(v=="6"){
    		$('p').fadeIn({
    			duration:1000
    		});
    	}
    });

    //【隐藏】按钮
    $("#btnFadeOut").click(function() {
        
        if (v == "1") {
            $("p").fadeOut();
        } else if (v == "2") {
            $("p").fadeOut("slow");
        } else if (v == "3") {
            $("p").fadeOut(6000);
        } else if (v == "4") {
            $("p").fadeOut(2000, function() {
                alert("隐藏完毕!");
            });
        } else if (v == "5") {
            $("p").fadeOut(1000, "linear");
        } else if (v == "6") {
            $("p").fadeOut({
                duration: 1000
            });
        }
    });
    </script>


正在回答

举报

0/150
提交
取消

为什么变量V不能作为全局变量?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信