JWebUnit is based on HttpUnit. I haven't used HtmlUnit, but the documentation provides says it provides partial support for JavaScript.
The essence of the problem is that these tools are simulating the browser. And since browsers all implement javascript differently, you aren't really testing how the code will behave. To truly test JavaScript, you can use a tool that runs in a browser like JSUnit or Selenium.
All of these three happen to be using the same JavaScript engine internally (Mozilla Rhino) so there shouldn't be that much of a difference between them. Having said that, I'd personally recommend HtmlUnit or JWebUnit over HttpUnit because the development for the latter seems to have halted and HtmlUnit (which JWebUnit uses internally) uses the Jakarta Commons HttpClient instead of a homegrown solution for handling HTTP (and HTTPS) connections, making it a lot more robust than HttpUnit.