<input type="button" onmousedown="Horario()" value="horario" class="event" onmouseup="Stop()">
<input type="button" onmousedown="AntHorario()" value="Anthorario" onmouseup="Stop()">
function Horario() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://192.168.137.55/horario=1");
xmlhttp.send();
}
function AntHorario() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://192.168.137.55/anthorario=1");
xmlhttp.send();
}
function Stop() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://192.168.137.55/stop=1");
xmlhttp.send();
}
答案 0 :(得分:0)
看起来您只需要添加触摸事件(ontouchstart
和ontouchend
属性):
<input type="button" onmousedown="Horario()" value="horario" class="event" onmouseup="Stop()" ontouchstart="Horario()" ontouchend="Stop()">
<input type="button" onmousedown="AntHorario()" value="Anthorario" onmouseup="Stop()" ontouchstart="AntHorario()" ontouchend="Stop()">
您可以在此处详细了解触控事件:Javascript touch events