$(function (){
// 开关控制
var arrClick2=["images/开(点击).png","images/关(点击).png"];
var arrClicked2=["images/开(未点击).png","images/关(未点击).png"];
$("#switch1 img").click(function() {
var clicked = $("#switch1 img[clicked]").index();
$("#switch1 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch1 img").click(function() {
var clicked = $("#switch1 img[clicked]").index();
$("#switch1 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch3 img").click(function() {
var clicked = $("#switch3 img[clicked]").index();
$("#switch3 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch4 img").click(function() {
var clicked = $("#switch4 img[clicked]").index();
$("#switch4 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch5 img").click(function() {
var clicked = $("#switch5 img[clicked]").index();
$("#switch5 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch6 img").click(function() {
var clicked = $("#switch6 img[clicked]").index();
$("#switch6 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch7 img").click(function() {
var clicked = $("#switch7 img[clicked]").index();
$("#switch7 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
$("#switch8 img").click(function() {
var clicked = $("#switch8 img[clicked]").index();
$("#switch8 img[clicked]").removeAttr("clicked").attr("src",arrClicked2[clicked]);
$(this).attr("clicked","clicked");
var index = $(this).index();
$(this).attr("src",arrClick2[index]);
});
// 指令
$("#5001a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5001a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5001b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5001b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5002a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5002a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5002b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5002b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5003a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5003a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5003b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5003b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5004a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5004a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5004b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5004b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5004c").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5004c",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5004d").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5004d",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5005a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5005a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5005b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5005b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5005c").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5005c",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5005d").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5005d",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5006a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5006a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5006b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5006b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5007a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5007a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5007b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5007b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5008a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5008a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5008b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5008b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5009a").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5009a",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
$("#5009b").on('click',function () {
$.ajax({
type:"get",
url:"udpclient.php?op=5009b",
dataType:"json",
success:function (data){
console.log(data);
// console.log(JSON.parse(data));
}
});
});
});
一键复制
编辑
Web IDE
原始数据
按行查看
历史