Здравейте! Пробвах се да напиша един jQuery код, който да извежда без рефреш. Ето какво написах:
Искам когато се натисне върху полето да се покаже съобщението. Благодаря предварително.
Код:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<meta http-equiv='CONTENT-LANGUAGE' content='bg' />
<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script>
$("#user").focus(function () {
var user = $("#user").val();
$.ajax({
type: "POST",
url: "check.php",
data: "user=" + user,
success: function(result) {
$("#result").hide().html(result).fadeIn("slow");
}
});
});
<script>
<style type="text/css">
#user {
width: 140px;
height: 20px;
background: url("images/user.png");
-moz-border-radius: 2px;
border: 0px;
color: #fff;
opacity: 0.80;
filter:alpha(opacity=80);
}
</style>
</head>
<body>
<form method="post" action="Pages/reg.php">
<table align="center">
<tr align="center">
<b style="color: #FFF;"><center>Ако нямате регистрация можете<br/> да си направите безплатна от тук:</center></b><br/>
<td style="color: #FFF;">Потребителско име*</td>
<td><input id="user" name="potrebitel" type="text" maxlength="20" style="opacity:0.8;filter:alpha(opacity=80)" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.8;this.filters.alpha.opacity=80" /></td>
<td width="100px"><div style="color: #FFF;" class="message" id="message"></div><p><span id="txtHint"></span></p></td>
</tr>
</table>
</form>
</body>
</html>