jQuery参数传递赋值的问题

<!DOCTYPE html>
<html>
<head>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
   <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
   <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function(){
  $("p").click(function(){
    $(this).hide();
  });
  
  var msg = "0";
  $("#btn").click(function(){
    msg = "1";
    alert("step1: "+msg);
    getdata(msg);
    //msg = getdata(msg);
    alert("step3: "+msg);
  });

  function getdata(msg){
    msg = "2";
    alert("step2: "+msg);
    return msg;
  }

});
</script>
<style>
p{cursor:pointer;}

.gradient{
    background: #104E8B;
    background: -moz-linear-gradient(top,  #104E8B 0%, #AEEEEE 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#AEEEEE), color-stop(100%,#AEEEEE));
    background: -webkit-linear-gradient(top,  #104E8B 0%,#AEEEEE 100%);
    background: -o-linear-gradient(top,  #104E8B 0%,#AEEEEE 100%);
    background: -ms-linear-gradient(top,  #104E8B 0%,#AEEEEE 100%);
    background: linear-gradient(to bottom,  #104E8B 0%,#AEEEEE 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#104E8B', endColorstr='#AEEEEE',GradientType=0 );
}
:root .gradient{filter:none;}
</style>
</head>
<body>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
<input type="button" value="click" id="btn" />

<div style="width:500px;height:500px;" class="gradient"></div>

</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值