<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<style>
.table {
background-color: rgb(250, 250, 250);
}
.table td {
border: outset 2px ;
min-width: 40px;
min-height: 40px;
}
.table td div {
text-align: right;
}
.table td div:first-child {
text-align: left;
}
.not-selectable {
background: url("http://javascript.ru/forum/attachment.php?attachmentid=1854&stc=1&d=1373743035") no-repeat center center;
}
.selected {
background: url("http://javascript.ru/forum/attachment.php?attachmentid=1856&stc=1&d=1373743035") no-repeat center center;
}
</style>
<button class="send">send</button>
<script>
jQuery(function ($) {
var str = "<table class=\"table\">";
for (var i = 1; i <= 7; i++) {
str += "<tr>";
for (var j = 1; j <= 10; j++) {
str += "<td><div>" + i + "</div><div>" + j + "</div></td>";
}
str += "</tr>";
}
str += "</table>";
$("body").prepend(str);
var table = $(".table").get(0);
table.rows[0].cells[0].className = "not-selectable";
table.rows[2].cells[3].className = "not-selectable";
table.rows[3].cells[5].className = "not-selectable";
$(".table").on("click", "td", function () {
if (this.className != "not-selectable") {
$(this).toggleClass("selected");
}
});
$(".send").on("click", function () {
var str="data=";
$.each($("td.selected"), function() {
str += this.parentNode.rowIndex + "," + this.cellIndex + ";";
});
alert(str);
$.ajax({
type: "POST",
url: "your.php",
data: str
});
});
});
</script>