だけあなたのJSコードは、ボックスの座標に責任があるので、それができるように持っていますブラウザは座標を知っています。
既に提出手続きがありますか?これは、HTML <フォーム>または完全にJS(XMLHttpRequest、jqueryなどの「ajax」とも呼ばれます)で実装できます。
AJAXベースの提出物をお持ちでしたら、おそらくこの質問はしませんので、私はあなたがHTML <フォームを持っていると仮定しています。 (画像はないかもしれないときは、本当に唯一のimg.onload` `内の画像を描画する必要があり
<!-- Instead of this you have a canvas with the box-selecting JS code.
When the user makes a selection, code similar to setCoords should
execute with the actual coordinates the user selected. -->
<input type="button" value="Set coordinates" onclick="setCoords(0,0,0,0)">
<form action="...">
<input id="x" name="x" type="hidden">
<input id="y" name="y" type="hidden">
<input id="w" name="w" type="hidden">
<input id="h" name="h" type="hidden">
<input type="submit">
</form>
<script>
function setCoords(x,y,w,h) {
document.getElementById("x").value = x;
// ...
}
</script>
、現在あなたが描いているが:ボックスを提出するには、フォームにいくつかの入力を追加する必要があります座標完全に)まだロードされていません。 – pimvdb
申し訳ありませんが、私は若干のJS noobです。その点について例を挙げて説明してもらえますか? – Magsol
恐らく私は誤解を招いていますが、現在あなたはすでに箱を選択していますか? – pimvdb