Analogical code implemented using jquery would look like this:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<script>
$(document).ready(function() { // this makes it execute only when DOM is loaded
$("#ho").click(function() { // run this when element with id "ho" is clicked
var $h = $("#hi"); // find element with id "hi"
alert("I love " + $h.val());
});
});
</script>
<form>
<input type="text" id="hi">
<input type="button" id="ho">
</form>
</body>
</html>
I am posting this as an example. Obviously, jQuery library takes some time to load, but it already solves many DOM manipulation tasks, and hides browser differences. The main advantage of jQuery is that your javascript is completely separate from HTML code.