HeatoNn Posted December 9, 2021 Report Posted December 9, 2021 (edited) 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 December 9, 2021 by HeatoNn 1
gigiRoman Posted December 9, 2021 Report Posted December 9, 2021 numaratoare inversa: Array sort reverse: https://www.w3schools.com/jsref/jsref_sort.asp in titlu scrie numaratoare crescatoare. Ai vrut sa zici ordonare? Pt numaratoare poti incerca un abac.
HeatoNn Posted December 9, 2021 Author Report Posted December 9, 2021 (edited) 2 hours ago, gigiRoman said: Array sort reverse: https://www.w3schools.com/jsref/jsref_sort.asp Cum o folosesc ca nu inteleg?+ imi trebuie comanda folosita in fisier extern Edited December 9, 2021 by HeatoNn 1
Moderators Dragos Posted December 10, 2021 Moderators Report Posted December 10, 2021 <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