您的位置:首页 > Web前端 > JQuery

jQuery参数传递赋值的问题

2016-05-11 18:01 477 查看
<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: