I’m sorry I don’t know how to put my code in PHP block.
</br>
<PHP>
//Here I have part of my javascript table
pisteet[6][0] = prompt(“Tunnistenumero:”, “3”)
pisteet[6][1] = prompt(“Tunnistenimi:”, “1”)
pisteet[6][2] = Number(prompt(“X-koordinaatti:”, 4572))
pisteet[6][3] = Number(prompt(“Y-koordinaatti:”, 1654))
pisteet[7][0] = prompt(“Tunnistenumero:”, “15”)
pisteet[7][1] = prompt(“Tunnistenimi:”, “1”)
pisteet[7][2] = Number(prompt(“X-koordinaatti:”, 8442))
pisteet[7][3] = Number(prompt(“Y-koordinaatti:”, 5624))
pisteet[8][0] = prompt(“Tunnistenumero:”, “21”)
pisteet[8][1] = prompt(“Tunnistenimi:”, “1”)
pisteet[8][2] = Number(prompt(“X-koordinaatti:”, 3214))
pisteet[8][3] = Number(prompt(“Y-koordinaatti:”, 9846))
//My purpose is to search two prompted points from the table above.
var p1 = prompt(“Piste 1 suuntakulman ja matkan laskemista varten:”, 3)
var p2 = prompt(“Piste 2 suuntakulman ja matkan laskemista varten:”, 21)
//No, those numbers aren’t really numbers so I am not looking for numbers in the table.
//Following do-while searches doesn’t work because they look numbers?
i=1
do
{
i++;
if(i == 100) break;
}
while(pisteet[i][0] = p1)
j=1
do
{
j++;
if(j == 100) break;
}
while(pisteet[j][0] = p2)
//So I want to input any two point number (Tunnistenumero) in promt p1 and p2 and calculate difference in Y-coordinates.
var etaisyys = ((pisteet[j][3]-pisteet[i][3]))
document.write(“<p>joo “,etaisyys,” “,pisteet[i][3]);
//pisteet[i][3] should write 1654
</PHP>
</br>
It might help you if I would upload the whole javascript, but as you requested, I didn’t.
So, basically I have a table of points with coordinates and I want to calculate difference in Y-coordinates between any of them.
I want to search points by their name (point numbers/tunnistenumero).
[B]I’ll try to make it more clearer:
Question: pisteet[?][0] = “3”
Answer should be: pisteet[6][0] = “3”
With above question how I can get above answer in javascript?
The rest I can do by myself.
Did you get what I want to do with javascript? (Because I doubt that you got it, but I did my best at pointing out the question so if nobody understands what I try to do, then never mind.)