• Home
  • Forum
  • Fare Web
  • Javascript

recupero coord mouse

  • Creatore Discussione Creatore Discussione pinzi83
  • Data di inizio Data di inizio 15 Ott 2007
P

pinzi83

Nuovo Utente
15 Ott 2007
5
0
0
  • 15 Ott 2007
  • #1
ciao a tutti, il seguente codice è una pagina html che scrive le coordinat e relative del mouse all'interno di 2 campi di una tabella.
solo che se apro con mozilla non funziona, se apro con explorer funziona.
strano perchè la parte di codice che calcola le coord relative del mouse in un altro file che fa qualcosa di simile funziona, ma qui come detto sopra funziona solo con exlorer.
potete per favore aiutare a capirmi perchè.
grazie infinite





<html>

<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>VIDEOSYSTEMS - MAIN PROGRAM TEST PAGE</title>

<script language="Javascript">

newImage0_1 = new Image();
newImage0_1.src = './image0.bmp?' + Math.random();

function RefreshIt() {
var bool = newImage0_1.complete;
if(bool){
document.images['myImage0'].src = newImage0_1.src;
newImage0_1.src = './image0.bmp?' + Math.random();

}
setTimeout('RefreshIt()', 20);

}

//funzione calcola le coordinate reali della immagine
var h;
var w;
var himmagine;
var wimmagine;
function grandezza_imm(){

imm = new Image();
imm.src = '2.jpg';
h = imm.height;
w = imm.width;
imma = document.getElementById('immagine');
himmagine = imma.height;
wimmagine = imma.width;

return himmagine,wimmagine;
}


function displayDivMouseCoords(e){

coords = getMouseCoordsWithinEventTarget(e);

document.getElementById('X').innerHTML = "<input maxlength ='3' size='2' type='text' name='Offset_x' value=' "+coords.x+"'>";
document.getElementById('Y').innerHTML = "<input maxlength ='3' size='2' type='text' name='Offset_y' value=' "+coords.y+"'>";
}

function getMouseCoordsWithinEventTarget(event){
grandezza_imm();
var coords = { x: 0, y: 0};

if(!event) // then we have a non-DOM (probably IE) browser
{
alert('if getMouseCoordsWithinEventTarget');

event = window.event;
a = event.offsetX;
b = event.offsetY;

coords.x = parseInt(event.offsetX * (parseFloat(w/wimmagine)));
coords.y = parseInt(event.offsetY * (parseFloat(h/himmagine)));

}
else // we assume DOM modeled javascript
{
alert('else funzione getMouseCoordsWithinEventTarget');
var Element = event.target ;
var CalculatedTotalOffsetLeft = 0;
var CalculatedTotalOffsetTop = 0 ;

while (Element.offsetParent)
{
CalculatedTotalOffsetLeft += Element.offsetLeft ;
CalculatedTotalOffsetTop += Element.offsetTop ;
Element = Element.offsetParent ;
}

parzx = event.pageX - CalculatedTotalOffsetLeft;
parzy = event.pageY - CalculatedTotalOffsetTop;

coords.x = parseInt(parzx * (parseFloat(w/wimmagine)));
coords.y = parseInt(parzy * (parseFloat(h/himmagine)));

}

return coords;
}


</script>


</script>

</head>

<body onLoad=" setTimeout('RefreshIt()', 20)" leftmargin="0" topmargin="50" bgcolor="#184070" lang="it" style='font-family:"Arial"'>

<center><img src="2.jpg" width="438" height="75">

<table><tr><td>

<table cellspacing="1" cellpadding="1">

<tr><td><table align="center">

<center>
<img id="immagine"src="2.jpg" width="400" height="300"name="myImage0"onmousedown="javascript:displayDivMouseCoords();">
</center>

</table></td>

<td>

<table colspan="3" bgcolor="#ffffff">

<center>

<table cellspacing="1" cellpadding="1" bgcolor="#000000">

<tr><td align="center" valign="middle">

<font size="+2" color="#ffffff"><b>IMPOSTAZIONI FINESTRA</b></font></td></tr>

<tr><td colspan="1" bgcolor="#ffffff">

<form action="setWindow.cgi" method="post">

<hr><center>

<table><tr><td>

<table border="0" cellspacing="1" cellpadding="1" bgcolor="#404040">

<tr><td bgcolor="#f0f0f0"><center>

<table>

<tr></tr>

<tr><td>Stato Telecamera:</td><td>

<td width="30" align="center" bgcolor="#40A040"><B>

0 </B></td>

</td></tr>

<tr></tr>

<tr><td>Temperatura Interna:</td><td>

<td width="30" align="center" bgcolor="#40A040"><B>
51.0 </B></td>

</td></tr>

<tr></tr>

<tr><td>Dimensione x Finestra Elaborazione:</td><td><input maxlength="3" size="2" type="text" name="WinElab_x">

<td width="30" align="center" bgcolor="#40A040"><B>

32 </B></td>

</td></tr>

<tr></tr>

<tr><td>Dimensione y Finestra Elaborazione:</td><td><input maxlength="3" size="2" type="text" name="WinElab_y">

<td width="30" align="center" bgcolor="#40A040"><B>

64 </B></td>

</td></tr>

<tr></tr>

<tr><td>Coordinata x Finestra Elaborazione:</td><td id="X"><input maxlength="3" size="2" type="text" name="Offset_x">

<td width="30" align="center" bgcolor="#40A040"><B>

128</B></td>

</td></tr>

<tr></tr>

<tr><td>Coordinata y Finestra Elaborazione:</td><td id="Y"><input maxlength="3" size="2" type="text" name="Offset_y">

<td width="30" align="center" bgcolor="#40A040"><B>

128</B></td>

</td></tr>

</td></tr>

</table>

</td></tr></table>

<br /><center><a href="sensor.html">Impostazioni del Sensore</a></center>

<center><a href="elab.html">Parametri di Elaborazione</a></center>

</center></td></tr></table>

</table>

</center>

<hr>

<center><input type="submit" value="Imposta parametri" /></center>

</form>

<center><form action="saveWindow.cgi" method="post">

<input type="submit" value="Salva Parametri"></center>

</form>

</td></tr></table>

</td></tr></table>

</center>

</body></html>
 
Devi accedere o registrarti per poter rispondere.

Discussioni simili

R
Recupero di permalink di un sito che è stato eliminato per errore
  • RobertaG
  • 24 Ott 2022
  • WordPress
Risposte
5
Visite
2K
WordPress 26 Ott 2022
glm1986ITALY
T
Recupero valori tramite $_GET
  • tirikiz
  • 28 Feb 2022
  • PHP
Risposte
4
Visite
1K
PHP 1 Mar 2022
tirikiz
T
O
Recupero valori da listato
  • ONE313
  • 9 Mag 2021
  • Javascript
Risposte
0
Visite
971
Javascript 9 Mag 2021
ONE313
O
S
problema con recupero dati tabella mysql
  • smartwork
  • 12 Apr 2021
  • PHP
Risposte
2
Visite
1K
PHP 13 Apr 2021
PaoloG
P
D
Recupero dati da HDD esterno
  • Domenico2013
  • 13 Gen 2021
  • Hardware
Risposte
0
Visite
2K
Hardware 13 Gen 2021
Domenico2013
D
T
foreach e fetchAll dove recupero solo l'ultimo record
  • twogate
  • 2 Set 2020
  • PHP
Risposte
5
Visite
1K
PHP 3 Set 2020
twogate
T
T
recupero valori select multipla da android
  • tigerman1467
  • 12 Lug 2020
  • Javascript
Risposte
3
Visite
2K
Javascript 14 Lug 2020
Max 1
W
Recupero password
  • windt
  • 22 Mag 2020
  • Classic ASP
Risposte
16
Visite
3K
Classic ASP 26 Mag 2020
windt
W
L
Recupero dati da SSD Windows 10 prof
  • Louiss97
  • 11 Mar 2020
  • Windows e Software
Risposte
3
Visite
2K
Windows e Software 24 Mag 2022
Louiss97
L
S
[PHP] Recupero nome immagine da Form con input file
  • solari77
  • 10 Nov 2019
  • PHP
Risposte
3
Visite
2K
PHP 12 Nov 2019
marino51
Recupero dati da una vecchia versione MySql [Risolto]
  • Sergio Unia
  • 24 Lug 2018
  • MySQL
Risposte
4
Visite
2K
MySQL 11 Ago 2018
Sergio Unia
[PHP] Recupero id autoincrement
  • bubino8
  • 10 Lug 2018
  • PHP
Risposte
8
Visite
5K
PHP 12 Lug 2018
bubino8
I
Recupero accesso pannello di controllo dominio
  • ilbuonuomomo
  • 13 Apr 2018
  • Leggi, Normative e Fisco
Risposte
2
Visite
1K
Leggi, Normative e Fisco 16 Apr 2018
ilbuonuomomo
I
S
[PHP] form con metodo get e recupero id
  • solari77
  • 26 Mar 2018
  • PHP
Risposte
4
Visite
3K
PHP 27 Mar 2018
borgo italia
[PHP] Check - Select e recupero variabili
  • Emix
  • 21 Feb 2018
  • PHP
  • 2 3
Risposte
40
Visite
8K
PHP 23 Feb 2018
macus_adi
[PHP] Recupero input senza invio
  • bubino8
  • 19 Gen 2018
  • PHP
Risposte
1
Visite
1K
PHP 19 Gen 2018
bubino8
U
[PHP] Selezione con menu a tendina e recupero selezione
  • ugo.ugo
  • 19 Dic 2017
  • PHP
Risposte
5
Visite
9K
PHP 26 Dic 2017
ugo.ugo
U
L
Problema con recupero dati in PHP cURL e JAVA con server
  • larosa.cristian
  • 6 Apr 2017
  • PHP
Risposte
1
Visite
1K
PHP 6 Apr 2017
criric
P
Javascript o Jquery - recupero testo (oltre al valore) di una select
  • psicona
  • 10 Mar 2017
  • Javascript
Risposte
5
Visite
4K
Javascript 10 Mar 2017
borgo italia
S
[PHP] Recupero più dati da form realizzata ciclo FOR
  • solari77
  • 23 Ott 2016
  • PHP
Risposte
5
Visite
4K
PHP 24 Ott 2016
marino51
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • Javascript
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?