Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <script>
- function pomestiLevo() {
- var cifra = document.getElementById('pole').value;
- cifra=cifra.split('');
- for(var i =cifra.length ; i >=0 ; --i){
- var tmp=cifra[cifra.length-1];
- cifra[cifra.length-1]=cifra[i];
- cifra[i]=tmp;
- }
- cifra=cifra.join('');
- document.getElementById('pole').value=cifra;
- }
- function pomestiDesno() {
- var cifra = document.getElementById('pole').value;
- cifra=cifra.split('');
- for(var i = 0 ; i < cifra.length ; i ++) {
- var tmp = cifra[i];
- cifra[i] = cifra[cifra.length-1];
- cifra[cifra.length-1] = tmp;
- }
- cifra=cifra.join('');
- document.getElementById('pole').value=cifra;
- }
- function Prevrti() {
- var cifra = document.getElementById('pole').value;
- cifra=cifra.split('');
- cifra.reverse();
- cifra=cifra.join('');
- document.getElementById('pole').value=cifra;
- }
- function Proveri() {
- var cifra = document.getElementById('pole').value;
- cifra=cifra.split('');
- var flag = Boolean(true);
- for(var i = 0 ; i < cifra.length; i ++){
- if(cifra[i]%2==0 && cifra[i+1] %2== 0 )
- {
- flag = false;
- }
- }
- if(flag == false){
- document.write("Brojot e perfekten");
- }
- }
- function Zacuvaj() {
- var cifra = document.getElementById('pole').value;
- var lista = document.getElementById('lista');
- var li=document.createElement('li');
- var text=document.createTextNode( 'izbrishan broj : ' +cifra );
- li.appendChild(text);
- lista.appendChild(li);
- document.getElementById('pole').value="";
- }
- </script>
- <body>
- <input type="text" id="pole">
- <button onclick="pomestiLevo()"><</button>
- <button onclick="pomestiDesno()">></button>
- <button onclick="Prevrti()">Flip</button>
- <button onclick="Proveri()">Check</button>
- <button onclick="Zacuvaj()">Store</button>
- <ul id="lista">
- </ul>
- </body>
- </html>
Add Comment
Please, Sign In to add comment