 |
|
|  |
[jQuery]¿öÅ͸¶Å© ÅؽºÆ®¹Ú½º ÄÁÆ®·Ñ ±¸Çö |
|
|
 |
8³â Àü |
<style type="text/css">
.water { color:Silver; }
</style>
<script src="../../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
// ·Îµå½Ã ÅؽºÆ®¹Ú½ºÀÇ ÅؽºÆ®¿¡ water Ŭ·¡½º Àû¿ë
$('#txtUserID').addClass("water");
// ·¹À̺íÀÇ °ªÀ» ¿öÅ͸¶Å©ÅؽºÆ®·Î °¡Á®¿È
var watermakedText = $('#lblUserID').remove().text();
$('#txtUserID').val(watermakedText)
.focus(function () {
if (this.value == watermakedText) {
$(this).val(''); // ÅؽºÆ®¸¦ ÀԷ°¡´ÉÇϵµ·Ï Ŭ¸®¾î
$('#txtUserID').removeClass("water"); // water CSS Ŭ·¡½º Á¦°Å
}
})
.blur(function () {
if (this.value == '') {
$(this).val(watermakedText); // ¾ÆÀ̵𸦠ÀÔ·ÂÇÏÁö ¾ÊÀ¸¸é ´Ù½Ã ¿öÅ͸¶Å©ÅؽºÆ®·Î ÁöÁ¤
$('#txtUserID').addClass("water"); // water CSS Ŭ·¡½º Àç Àû¿ë
}
});
// Àü¼Û½Ã °ªÀ» ÀÔ·ÂÇÏÁö ¾ÊÀ¸¸é, ºó°ªÀ¸·Î ÃʱâÈ
$('form').submit(function () {
// ÅؽºÆ®¹Ú½ºÀÇ °ªÀÌ ¿öÅ͸¶Å©ÅؽºÆ®¶ó¸é ºó°ªÀ¸·Î ó¸®
if ($('#txtUserID').val() == watermakedText) {
$('#txtUserID').val('');
return false; // submit À̺¥Æ® ¸ØÃã
}
});
}); // end ready()
</script>
<form name="frm" action="WaterMarkTextBox.aspx">
<label id="lblUserID" for="txtUserID">¾ÆÀ̵𸦠ÀÔ·ÂÇϽÿÀ.</label>
<input name="txtUserID" id="txtUserID" type="text">
<input type="submit" value="Àü¼Û">
</form>
|
|
̵̧ : 362 |
̵̧
¸ñ·Ï
|
|
|  |
|