Javascript Fehlersuche
G_Note
- javascript
Hallo Leute.
Kann mir jemand sagen wo hier der Fehler ist?:D
[code lang=javascript]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Javascript</title>
<script type="text/javascript">
function Quadrieren (Zahl) {
if (Ergebnis > 0) {
var Ergebnis = document.Formular.Eingabe.value * document.Formular.Eingabe.value;
alert( document.Formular.Eingabe.value + " x " + document.Formular.Eingabe.value + " = " + Ergebnis);
}
else {
var ERROR = "ERROR - Gib bitte eine Zahl ein (nur ganze und Dezimalzahlen m\u00f6glich)";
alert(ERROR);
}
}
</script>
</head>
<body>
<form name="Formular">
<input type="text" name="Eingabe" size="3" >
<input type="button" value="Quadrieren" onclick="Quadrieren()">
</form>
</body>
</html>
Du sagst ja nicht was passiert, aber ich sehe folgendes
if (Ergebnis > 0) {
var Ergebnis = document.Formular.Eingabe.value * document.Formular.Eingabe.value;
Du fragst Ergebnis ab und legst aber erst danach fest was Ergebnis überhaupt sein soll.
Du sagst ja nicht was passiert, aber ich sehe folgendes
if (Ergebnis > 0) {
var Ergebnis = document.Formular.Eingabe.value * document.Formular.Eingabe.value;
Du fragst Ergebnis ab und legst aber erst danach fest was Ergebnis überhaupt sein soll.
danke:)
das war der fehler
demo gibts hier: http://tbprojects.bplaced.net/JavaScript.html