<code><!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>无标题文档</title>
<script type=
"text/javascript"
src=
"jquery-2.1.1.min.js"
></script>
</head>
<body>
<p id=
"page"
>
<p>
<a href=
"/signup/"
onclick=
"app.requireLogin();return false;"
>注册</a>
<a href=
"#"
onclick=
"app.requireLogin('', {to: 'login'});return false;"
>登录</a>
</p>
</p>
<script>
var
app = {
requireLogin :
function
(a, b) {
console.log(b.to +
"----"
);
if
(b.to ==
'login'
) {
$(
'#page'
).append(
'<h1>1111111</h1>'
);
}
},
requireLogin :
function
() {
console.log(
'reg'
);
$(
'#page'
).append(
'<h1>2222</h1>'
);
}
};
</script>
</body>
</html>
</code>