What tool are you using to interact with the DOM? If you are using selenium, ENTER is an available keypress event that you can trigger on a particular element: http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/Keys.html.
var e = $.Event('keypress');
e.which = 13;
>>> from selenium import webdriver
>>> ff = webdriver.Firefox()
>>> from selenium.webdriver.common.keys import Keys
>>> el = ff.find_element_by_css_selector('#tbInput')
# Alert popped up twice!
If you expect to be doing more UI testing along these lines, the investment in selenium might be worth it.