• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

If-Bedingung

cn44

Neues Mitglied
Hi!
Ich bin leider ein ziemlicher Anfänger was Programmieren bzw HMTL anbelangt...


<head>
<title>A little Quiz!</title>

<script language="Object Rexx">
::routine work public
output~innerhtml=correct if input~value=20 else output~innerhtml=incorrect
</script>

</head>

<body>

<h1>Welcome to the Quiz!</h1> <BR>

<p>Please answer the following questions as accurately as possible and see if you belong to the kind

of Clever&Smart or if you feel more akin with Dumb & Dumber!!! ;-)<p> <BR>

<p> What is your name? <p>


<input id="input" type="textarea" size="50"> <BR>

<input type="BUTTON" onclick="call work" language="Object Rexx"
value="Please Press Me!"><p> <BR>

<p id="output"> <BR>


Ich wollte erreichen, dass wenn man 20 eintippt, danach "correct" erscheint, andernfalls soll "incorrect" erscheinen... bekomms aber irgendwie nicht hin... ;ugl

Thx schon mal!
 
Werbung:
Du versuchst JavaScript zu schreiben, dies ist das HTML-Forum. HTML ist keine Programmiersprache, damit kann man auch nicht programmieren.
Und mit JavaScript hat der Code oben nichts gemeinsam.

SELFHTML: JavaScript/DOM
 
in js würd das dann so aussehen:
Code:
function check(){
eingabe = document.getElementById('input');
if(eingabe.value == ""){
alert('Bitte gebe erst etwas ein...');
}
else if(eingabe.value == 20){
alert('Korrekt');
}else{
alert('inkorrekt');
}
}
Aufrufen kann man das dann so:
Code:
<input type='button' onclick='check();'>
Das Inputfeld müsste dann so aussehen:
Code:
<input id='input'>
 
Werbung:
Zurück
Oben