grazie mille andrea proverò a fare quello che mi hai detto, spero di esserne capace.
Dove scrivi manca form action devo scrivere il file php al quale invio i dati?
Cosa intendi per ora è un problema di php?
Ti invio il codice completo della pagina che sto testando.
Ho "attivato" solo una immagine per provare.
Non riesco a capire dove mettere il form. Ho provato a spostare come suggerisci tu lo script fuori dai tag head (da dove lo ho scaricato dicevano di inserirlo prima di </head>.
Ho tirato fuori questa pagina.
E' corretta. Nel form di debug che mi ha messo vedo le coordinate quando draggo l'immagine. Credo quindi che tu mi abbia risolto il problema perchè mi basta vedere un pò come funziona l'Action di modo che invio le coordinate ad un file php che si occuperà di inserirle nel database.
Grazie mille
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-ev="Content-Language" content="it">
<title>LA FORMAZIONE</title>
<meta http-ev="Content-Type" content="text/html; charset=windows-1252">
<meta name="keywords" content="calcio,calcio a 7,kickoff,torneo,sangiuliano,fantacalcio,classifica,calendario,risultati,san giuliano,kick off">
<meta http-ev="expires" content="0">
</head>
<body link ="#FF9933" vlink="#FF9933" alink="#FF9933" style="background-color: #FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" OnLoad="window.defaultStatus='VG Sangiuliano Official Website';">
<style> a {text-decoration: none}</style>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="640" height="1">
<tr><td width="640" height="1"></td></tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="640" height="148">
<tr>
<td width="20" height="148" rowspan="2"></td>
<td width="100" height="74">
[img]squadra/gigimedia.jpg[/img]
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="20" height="148" rowspan="2"></td>
</tr>
<tr>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
<td width="100" height="74">
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="640" height="333">
<!--<tr>
<td>[img]squadra/shim.gif[/img]</td>
<td>[img]squadra/shim.gif[/img]</td>
<td>[img]squadra/shim.gif[/img]</td>
<td>[img]squadra/shim.gif[/img]</td>
<td>[img]squadra/shim.gif[/img]</td>
<td>[img]squadra/shim.gif[/img]</td>
</tr>-->
<tr>
<td align="center" width="128" height="111" background="squadra/split_C1_R1.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C2_R1.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C3_R1.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C4_R1.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C5_R1.jpg"></td>
</tr>
<tr>
<td align="center" width="128" height="111" background="squadra/split_C1_R2.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C2_R2.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C3_R2.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C4_R2.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C5_R2.jpg"></td>
</tr>
<tr>
<td align="center" width="128" height="111" background="squadra/split_C1_R3.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C2_R3.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C3_R3.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C4_R3.jpg"></td>
<td align="center" width="128" height="111" background="squadra/split_C5_R3.jpg"></td>
</tr>
</table>
<form name="saveformazione">
<input type="hidden" name="gigimedia_x" />
<input type="hidden" name="gigimedia_y" />
<input type="text" value="" name="testo" />
</form>
<style type="text/css">
.drag{
position:relative;
cursor:hand;
z-index: 100;
}
</style>
<script type="text/javascript">
var dragobject={
z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
initialize:function(){
document.onmousedown=this.drag
document.onmouseup=function(){this.dragapproved=0}
},
drag:function(e){
var evtobj=window.event? window.event : e
this.targetobj=window.event? event.srcElement : e.target
if (this.targetobj.className=="drag"){
this.dragapproved=1
if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
this.offsetx=parseInt(this.targetobj.style.left)
this.offsety=parseInt(this.targetobj.style.top)
this.x=evtobj.clientX
this.y=evtobj.clientY
if (evtobj.preventDefault)
evtobj.preventDefault()
document.onmousemove=dragobject.moveit
}
},
moveit:function(e){
var evtobj=window.event? window.event : e
if (this.dragapproved==1){
this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
//Aggiunta
var imgpath = this.targetobj.src;
var fieldname = imgpath.substring(imgpath.lastIndexOf("/")+1, imgpath.length-4);
document.saveformazione.elements[fieldname+"_x"].value=this.offsetx+evtobj.clientX-this.x;
document.saveformazione.elements[fieldname+"_y"].value=this.offsety+evtobj.clientY-this.y;
//la riga seguente è solo di debug, a script finito si può eliminare.
document.saveformazione.testo.value=fieldname+" X = "+document.saveformazione.elements[fieldname+"_x"].value+" Y = "+document.saveformazione.elements[fieldname+"_y"].value;
//Fine aggiunta
return false
}
}
}
dragobject.initialize()
</script>
</body>
</html>