JavaScript
- 43 ответа
- 0 вопросов
25
Вклад в тег
handleTouchStart =function(e) {
xDown = e.touches[0].clientX;
yDown = e.touches[0].clientY;
};
handleTouchMove = function(e) {
if ( ! xDown || ! yDown ) {
return;
}
var xUp = e.touches[0].clientX;
var yUp = e.touches[0].clientY;
var xDiff = xDown - xUp;
var yDiff = yDown - yUp;
if(Math.abs( xDiff )+Math.abs( yDiff )>150)
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {
if ( xDiff > 0 )
alert('лево');
else
alert('право');
} else {
if ( yDiff > 0 )
alert('вверх');
else
alert('вниз');
}
xDown = null;
yDown = null;
};
var xDown = null;
var yDown = null;
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false);
@RequestMapping(value = "/adminNewClient", method = RequestMethod.DELETE)
public @ResponseBody Map adminNewClientPost(HttpServletResponse response, HttpServletRequest request,
@RequestParam(value = "name") String name,
@RequestParam(value = "surName") String secondName,
@RequestParam(value = "birthday") String birthdayDate,
@RequestParam(value = "passport") String passport,
@RequestParam(value = "adress") String adress,
@RequestParam(value = "email") String eMail,
@RequestParam(value = "number") String number) {
LinkedHashMap result = new LinkedHashMap();
result.put("nameStat","YES!");
return result;
}
<tr>
<td><input id="surName" type="text" class="form-control" placeholder="Surname"></td>
<td><span style="color:blue;" id="nameStat">${nameStat}</span></td>
</tr>
function popBox() {
x = confirm('Are you sure? ');
if (x == true) {
var xhr = new XMLHttpRequest();
xhr.onload = function(){
var jsonResponse = JSON.parse(this.responseText);
for(var index in jsonResponse) {
if (jsonResponse.hasOwnProperty(index)) {
document.getElementById(index).innerText = jsonResponse[index];
}
}
};
xhr.open("DELETE", "adminNewClient?name=" + name + "&surName=" + surName
+ "&birthday=" + birthday + "&passport=" + passport
+ "&adress=" + adress + "&email=" + email + "&number=" + number, false);
xhr.send();
}
}