嗨,我在这里使用此代码http://jsfiddle.net/bryanjamesross/pyNJ9/我将整个代码隔离在一页中..就像这个标签下的 javascript
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
</script>
和下的css代码
<script type="text/css">
</script>
并在 html 标签中使用了 html 代码。但我也得到了文本框,而不是单个登录 href 链接。
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/cupertino/jquery-ui.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$('a.loginlink').click(function(e) {
$('#loginform').dialog('open');
e.preventDefault();
return false;
});
$('#loginform').dialog({
autoOpen: false,
modal: true,
resizable: false,
draggable: false
});
</script>
</head>
<body>
<a href="mytest.html" class="loginlink">Log In</a>
<div id="loginform">
<form action="/login" method="post">
<table>
<tr>
<td>User Name:</td>
<td>
<input name="username" type="text" />
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<input name="password" type="password" />
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="submit" value="Login" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>