aroshanzamir
یک شنبه 07 مهر 1392, 01:15 صبح
سلام دوستان :
من یه دکمه روی صفحه دارم که می خواهم وقتی روش کلیک کردم یه پنجره نمایش داده بشه :
که توی اون پنجره باز شو یه تکست باکس و یه دکمه دارم ...بعدش می خواهم وقتی رو دکمه کلیک کردم پنجره باز شو بسته شود ... ولی باید دوبار کلیک کنم تا بسته شود ...بار اول دوبار کلیک می کنم تا بسته شود ولی مابقی بار ها با 1 بار کلیک بسته می شود :
<style type="text/css">
.Base {
width: 900px;
height: 600px;
z-index:1;
background-color: gray;
margin: 10px auto;
text-align: center;
}
.popup {
width: 160px;
height: 100px;
background-color: #eee;
position: absolute;
top: 50%;
left: 30%;
z-index:10;
text-align: center;
}
</style>
<script src="jquery-1.9.1.js"></script>
<script type="text/javascript">
function Remove() {
$('#btnRemove').click(function () {
$('#divfloat').hide();
alert($('#txtUserName').val());
});
}
$(document).ready(function () {
$('#divfloat').hide();
$('#btnCreate').click(function () {
$('#divfloat').show();
});
});
</script>
<body>
<div class="Base" id="Base">
<input type="button" value="Create" id="btnCreate" />
</div>
<div id="divfloat" class="popup">
<br />
<input type="text" id="txtUserName" /><br /><br />
<input type="button" value="Remove" id="btnRemove" onclick="Remove();" />
</div>
</body>
حالا چکار کنم که برای اولین بار با یک کلیک بسته شود
ممنون....
من یه دکمه روی صفحه دارم که می خواهم وقتی روش کلیک کردم یه پنجره نمایش داده بشه :
که توی اون پنجره باز شو یه تکست باکس و یه دکمه دارم ...بعدش می خواهم وقتی رو دکمه کلیک کردم پنجره باز شو بسته شود ... ولی باید دوبار کلیک کنم تا بسته شود ...بار اول دوبار کلیک می کنم تا بسته شود ولی مابقی بار ها با 1 بار کلیک بسته می شود :
<style type="text/css">
.Base {
width: 900px;
height: 600px;
z-index:1;
background-color: gray;
margin: 10px auto;
text-align: center;
}
.popup {
width: 160px;
height: 100px;
background-color: #eee;
position: absolute;
top: 50%;
left: 30%;
z-index:10;
text-align: center;
}
</style>
<script src="jquery-1.9.1.js"></script>
<script type="text/javascript">
function Remove() {
$('#btnRemove').click(function () {
$('#divfloat').hide();
alert($('#txtUserName').val());
});
}
$(document).ready(function () {
$('#divfloat').hide();
$('#btnCreate').click(function () {
$('#divfloat').show();
});
});
</script>
<body>
<div class="Base" id="Base">
<input type="button" value="Create" id="btnCreate" />
</div>
<div id="divfloat" class="popup">
<br />
<input type="text" id="txtUserName" /><br /><br />
<input type="button" value="Remove" id="btnRemove" onclick="Remove();" />
</div>
</body>
حالا چکار کنم که برای اولین بار با یک کلیک بسته شود
ممنون....