我的目标是#box2在我点击#box1时出现,但当你点击其他内容时#box2,它将不会显示任何内容,只会#box1显示.
这是我的2个盒子,它们只是2个风格的div:
var condition;
$(document).click(function() {
if (condition === 'block') {
$(":not(#box2)").click(function() {
$("#box2").hide();
});
}
})
$('#box1').click(function(e) {
$('#box2').css('display', 'block');
condition = 'block';
});
$('#box2').click(function(e) {
$('#box2').css('display', 'none');
condition = 'none';
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="box1" style="width: 300px; height: 300px; background-color: red; margin-left: 100px; margin-bottom: 50px; position: absolute;">
</div>
<div id="box2" style="width: 300px; height: 300px; background-color: blue; margin-left: 150px; display: none; position: absolute;">
</div>Run Code Online (Sandbox Code Playgroud)
这个当前代码第一次正常工作,但在那之后,它不会再次运行.我只是想知道是否有重置功能或我错在哪里?
我真正要做的就是让它在ipad上工作,这样当用户点击/点击该框时,它就会关闭.如果有更好的方法在Ipad平板电脑上执行此操作,请告诉我!
有任何想法吗?
我在查找如何调用我在.CS文件中编写的方法时会遇到一些麻烦,该文件将更新数据库中的用户密码.
这是我目前的表格:
<form method="post" action="#" runat="server" name="edit_password_form">
<div id="edit_password_popup">
<table width="390" align="center" padding="10">
<tr>
<td><span class="error_field">*</span>Password:<br>
<input type="password" name="password_1" id="password_1" size="19" maxlength="30" autocapitalize="off" autocorrect="off" autocomplete="off">
</td>
<td><span class="error_field">*</span>Confirm Password:<br>
<input type="password" name="password_2" id="password_2" size="19" maxlength="30" autocapitalize="off" autocorrect="off" autocomplete="off">
</td>
</tr>
<tr>
<td><input type="submit" value="Add Password" id="add_pass" alt="Add Password" border="0"></td>
<td><input type="button" value="No Thanks" id="no_thanks" alt="No Thanks" border="0"></td>
</tr>
</table>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我可能在.aspx文件中使用c#方法而不是.aspx.cs吗?
我希望在单击add_pass按钮时运行C#方法.有关如何实现这一目标的任何想法?