<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<title>strona</title>
<script src="js.js"></script>
</head>
<body>
<input id="pole1" type="text" >
<input id="pole2" type="text" >
<input type="submit" value="przycisk" onclick="wypisz()">
<div id="wynik"></div>
</body>
</html>
function wypisz()
{
var liczba1 = document.getElementById("pole1").value;
var liczba2 = document.getElementById("pole2").value;
var napis = "";
if (liczba1>liczba2)
{
for (i=liczba1; i<=liczba2; i++)
{
napis = napis + i + " ";
}
document.getElementById("wynik").innerHTML = napis;
}
else if (liczba2>liczba1)
{
for (i=liczba2; i<=liczba1; i++)
{
napis = napis + i + " ";
}
document.getElementById("wynik").innerHTML = napis;
}
}
Czemu tak nie działa?