I am sorry to say that there are many errors.
And even if there were such unduplicated form elements, you keep over-writing the value of elem.
If all you want to do is to multiply four fixed numbers together, then
var v1 = 10;
var v2 = 10;
var v3 = 0.3;
var v4 = 40;
document.getElementById("answer").value = ans;
Be aware that form field values are strings unless/until converted to numbers by one of several methods, Number() being recommended.
var val1= Number(document.getElementById("v1").value) || 0; // || 0 traps NaN entries and changes them to 0.
val1 = Math.floor(val1); // (or Math.round) - make val1 integer
// Now check that val1 is within a sensible range, and (presumably) not negative.
Finally, put newlines between each line of your HTML code. It makes it unreadable if you run them all together into one long line.
is completely unnecessary - I have forgotten exactly why in the distant past it was required in some early browsers.
Your style sheet is also purposeless. It specifies what are the default colors anyway. I would advise you not to try to bite off too much at one sitting - keep your early attempts simple and check them frequently to see if they run OK, then build on your work. Rather than Coffee Cup Editor I would recommend that you use plain old Notetab or Notepad++.
"In the beginner's mind there are many possibilities, but in the expert's mind there are few” - Shunryu Suzuki (Japanese Zen priest, ?-1971)