indsæt i databasen hvilklet felt man står på?
Hey eksperter!!Har et lille alá html problem!
Dette ryk din figur script, vil jeg have til at vise hvad felt den står på i databasen, altså at vær felt har sit eget navn som fx.: felt_1 felt_2 osv.
Og så når man klikker på et felt skal den opdatere det i databasen, så i kolonen felt står der eksempelvis felt_4.
Koden:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#table {
border-collapse: collapse;
}
#table td {
width: 61px;
height: 71px;
text-align: center;
vertical-align: middle;
cursor: kliker;
}
</style>
<script type="text/javascript">
var last_field = null;
function moveElement(field) {
obj = document.getElementById(field);
if (last_field != null) last_field.innerHTML = ' ';
document.getElementById(field).innerHTML = '<div><img src="figur.gif" height="60" widht="60"></div>';
last_field = obj;
}
</script>
</head>
<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
<table id="table" background="bg.bmp">
<tr>
<td id="1_1" onclick="moveElement(this.id)"> </td>
<td id="1_2" onclick="moveElement(this.id)"> </td>
<td id="1_3" onclick="moveElement(this.id)"> </td>
<td id="1_4" onclick="moveElement(this.id)"> </td>
<td id="1_5" onclick="moveElement(this.id)"> </td>
<td id="1_6" onclick="moveElement(this.id)"> </td>
<td id="1_7" onclick="moveElement(this.id)"> </td>
</tr><tr>
<td id="2_1" onclick="moveElement(this.id)"> </td>
<td id="2_2" onclick="moveElement(this.id)"> </td>
<td id="2_3" onclick="moveElement(this.id)"> </td>
<td id="2_4" onclick="moveElement(this.id)"> </td>
<td id="2_5" onclick="moveElement(this.id)"> </td>
<td id="2_6" onclick="moveElement(this.id)"> </td>
<td id="2_7" onclick="moveElement(this.id)"> </td>
</tr><tr>
<td id="3_1" onclick="moveElement(this.id)"> </td>
<td id="3_2" onclick="moveElement(this.id)"> </td>
<td id="3_3" onclick="moveElement(this.id)"> </td>
<td id="3_4" onclick="moveElement(this.id)"> </td>
<td id="3_5" onclick="moveElement(this.id)"> </td>
<td id="3_6" onclick="moveElement(this.id)"> </td>
<td id="3_7" onclick="moveElement(this.id)"> </td>
</tr><tr>
<td id="4_1" onclick="moveElement(this.id)"> </td>
<td id="4_2" onclick="moveElement(this.id)"> </td>
<td id="4_3" onclick="moveElement(this.id)"> </td>
<td id="4_4" onclick="moveElement(this.id)"> </td>
<td id="4_5" onclick="moveElement(this.id)"> </td>
<td id="4_6" onclick="moveElement(this.id)"> </td>
<td id="4_7" onclick="moveElement(this.id)"> </td>
</tr>
<tr>
<td id="5_1" onclick="moveElement(this.id)"> </td>
<td id="5_2" onclick="moveElement(this.id)"> </td>
<td id="5_3" onclick="moveElement(this.id)"> </td>
<td id="5_4" onclick="moveElement(this.id)"> </td>
<td id="5_5" onclick="moveElement(this.id)"> </td>
<td id="5_6" onclick="moveElement(this.id)"> </td>
<td id="5_7" onclick="moveElement(this.id)"> </td>
</tr>
</table>
<script type="text/javascript">moveElement('1_1');</script>
</body>
</html>
Håber jeg kan få hjælp eksperter!
På forhånd tak...
