Jump to content
HeatoNn

Pop-up cu numaratoarea crescatoare

Recommended Posts

function scrieText()
{
var x=12;
var y=13;
var z=14;
if (x<y && y<z){
 Ordinea=x,y,z
}
var raspuns=prompt("Alege un numar?","");
var raspuns=prompt("Alege un numar?","");
var raspuns=prompt("Alege un numar?","");
document.getElementById('Ordinea').innerHTML=Ordinea;
            alert();
}

(fisier JAVASCRIPT)

<html>
<head>
<title> Numere crescatoare
</title>
<script type="text/javascript" src="exemplu2.js"></script>
</head>
<body>
<h1 align="center">Ordinea crescatoare a numerelor preferate</h1>
<INPUT TYPE="button" name="buton" onclick="scrieText()" value="Afla ordinea">
 <div id="Ordinea"></div>
</body>
</html>

(fisier HTML)

ce comanda trebuie sa mai aplic pentru a-mi arata in pop-up numaratoarea crescatoare a celor 3 variabil x y z ? Cele 3 variabile trebuie definite in pop up prin functia prompt

Edited by HeatoNn
  • Downvote 1
Link to comment
Share on other sites

  • Moderators
<html>

<head>
    <title> Numere crescatoare
    </title>
    <script type="text/javascript">
        function scrieText() {
            var x = [];
            x.push(prompt("Alege un numar?", ""));
            x.push(prompt("Alege un numar?", ""));
            x.push(prompt("Alege un numar?", ""));
            x.sort();
            document.getElementById('Ordinea').innerHTML = x[0] + " " + x[1] + " " + x[2];
        }
    </script>
</head>

<body>
    <h1 align="center">Ordinea crescatoare a numerelor preferate</h1>
    <INPUT TYPE="button" name="buton" onclick="scrieText()" value="Afla ordinea">
    <div id="Ordinea"></div>
</body>

</html>


Te rog nu-ti pune aici toate temele de la scoala sau facultate. Sau, daca faci asta, da-le la oameni ceva, un ban, un piscot in schimb.

 

//closed

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...