Witam, chciałem zrobić sobie prosty przykład, który by dodawał dwie liczby do siebie, które użytkownik wpisuje fo formularza. Problem jest w tym, że alert nie wyskakuje. Oto kod:
CODE
<form id="licz" name="licz" action=""><div>
<input type="text" name="first" id="first">
<input type="text" name="second" id="second">
<button onclick="return licz()">Dodaj!</button>
</div></form>
<script>
function licz()
{
var first = document.forms['licz'].first.value;
var second = document.forms['licz'].second.value;
var suma;
suma = first + second ;
alert('Wynik' +suma+ "!');
return false;
}
</script>
<input type="text" name="first" id="first">
<input type="text" name="second" id="second">
<button onclick="return licz()">Dodaj!</button>
</div></form>
<script>
function licz()
{
var first = document.forms['licz'].first.value;
var second = document.forms['licz'].second.value;
var suma;
suma = first + second ;
alert('Wynik' +suma+ "!');
return false;
}
</script>
Dodam, że jestem kompletnie zielony, ponieważ dopiero się uczę

POZDRAWIAM Inspired