типо такого?
<!DOCTYPE html>
<html>
<head>
<title>example</title>
</head>
<body>
<input type="text"><input type="text"><input type="button" value="ok">
<div></div>
<script>
var text = document.querySelectorAll('input[type=text]'),
button = document.querySelector('input[type=button]'),
div = document.querySelector('div');
button.onclick = function ()
{
var value1 = text[0].value,
value2 = text[1].value,
result;
result = Math.abs(value1 - value2) > 100 ? 'больше 100' : 'меньше 100';
div.innerHTML = result;
}
</script>
</body>
</html>