Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script language="JavaScript">
<!--
function ergebnis() {
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input2");
var input3 = document.getElementById("input3");
var val1 = +input1.value;
var val2 = +input2.value;
var operate = {
"*" : val1 * val2,
"/" : val1 / val2,
"+" : val1 + val2,
"-" : val1 - val2
};
alert("Das ergebnis lautet: " + operate);
}
if (typeof operate[select.value] != "undefined") {
input3.value = operate[select.value]
}
//-->
</script>
<noscript></noscript>
<title></title>
<meta name="author" content="user">
<meta name="editor" content="html-editor phase 5">
</head><body alink="#ff0000" bgcolor="#ffffff" text="#000000" vlink="#ff0000" link="#ff0000">
<form id="rechner">
<input size="5" id="input1" type="text">
<select id="input3" size="1">
<option>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<input size="5" name="input2" type="text">
<input value="=" onclick="ergebnis()" type="button">
</form>
</body></html>
Für eine Gute Antowort / Lösung biete ich 5 EG !






