テキストボックスにフォーカスがある時にエンターキーでイベントを起動

html側

<input type="text" onkeypress="hoge(event.keyCode);" />


JavaScript

function hoge(code)
{
	//エンターキー押下なら
	if(13 === code)
	{
		alert("エンターキーが押されたよ!");
	}
}