定义为全局变量就可以了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>手写html</title>
<!-- 引入外部js -->
<script type="text/javascript" src="jquery-1.7.js"></script>
<script type="text/javascript">
var c;
$(function(){
$("#a").click(function(){
c=111;
});
$(function(){
$("#b").click(function(){
alert(c);
});
});
});
</script>
<!-- 写css样式 -->
<style type="text/css">
</style>
</head>
<body>
<input type="button" value="点击设置 全局变量c 为111" id="a"/>
<input type="button" value="点击设置 显示变量c" id="b"/>
</body>
</html>