以下は、onblur を使用して「動的」ID を示すアラートを作成する方法です。入力フィールドを含むwhileループがあるため、IDはデータベース内の一意のIDから取得されます。
どうすれば値も取得できますか?通常はいつものように変数を設定するだけですが、ループしているので方法がわかりません。
<script type="text/javascript">
function doUpdateEntries(clicked_id) {
alert(clicked_id);
// how do I get the value AND id?
}
</script>
while ($row = mysql_fetch_assoc($result)) {
<input onblur="doUpdateEntries(this.id);" id=".$row['entry_id']." name=".$row['entry_id']." type="text" value=".$row['reviews'].">
}