consolidate all repos to one for archive

This commit is contained in:
2025-01-28 13:46:42 +01:00
commit a6610fbc7a
5350 changed files with 2705721 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="sl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo vaja 4 - Javascript</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<header>
<h1>Demo vaja 4 - Javascript</h1>
</header>
<div>
<button type="button" onclick="openPrompt()">Odpri prompt okno</button>
</div>
<div id="tableContainer">
<!-- Tukaj bomo vstavili tabelo -->
<figure id="tableFigure">
</figure>
</div>
<div id="formContainer">
<!-- Nad formo bomo izvedli preverjanje ustreznosti vsebine -->
<form method="GET" action="index.html">
<label>Uporabniško ime</label><br>
<input id="usernameInput" type="text" oninput="onUsernameChange()"><span id="usernameWarning" class="incorrectInput">Neprimerno uporabniško ime</span><br>
<label>Geslo</label><br>
<input id="passwordInput" type="password" oninput="onPasswordChange()"><span id="passwordWarning" class="incorrectInput">Neprimerno geslo</span><br><br>
<input id="submitButton" type="submit">
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,120 @@
var usernameInput = null;
var usernameWarningSpan = null;
var passwordInput = null;
var passwprdWarnignSpan = null;
var submitButton = null;
window.onload = (event) =>
{
usernameInput = document.getElementById("usernameInput");
usernameWarningSpan = document.getElementById("usernameWarning")
passwordInput = document.getElementById("passwordInput")
passwordWarnignSpan = document.getElementById("passwordWarning")
submitButton = document.getElementById("submitButton");
console.log(usernameInput);
checkSubmit()
};
function onUsernameChange()
{
console.log(usernameInput.value);
if(/^[a-zA-Z0-9_.,]+$/.test(usernameInput.value)) //ustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "correctInput");
usernameWarningSpan.innerHTML = "Primerno uporavniško ime";
}
else //neustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "incorrectInput");
usernameWarningSpan.innerHTML = "Neprimerno uporavniško ime";
}
checkSubmit()
}
function onPasswordChange()
{
if(/^[a-zA-Z0-9_.,]*[A-Z]+[a-zA-Z0-9_.,]*$/.test(passwordInput.value) && passwordInput.value.length >= 6)
{
passwordWarnignSpan.setAttribute("class", "correctInput");
passwprdWarnignSpan.innerHTML = "Primerno geslo";
}
else
{
passwordWarnignSpan.setAttribute("class", "incorrectInput");
passwprdWarnignSpan.innerHTML = "Neprimerno geslo";
}
checkSubmit()
}
function checkSubmit()
{
const usernameWarningClass = usernameWarningSpan.getAttribute("class");
const passwordWarningClass = passwordWarnignSpan.getAttribute("class");
//ali "incorectInput" ali "CorrectInput"
if(usernameWarningClass == 'IncorrectInput' || passwordWarningClass == 'IncorrectInput')
{
submitButton.disabled = true;
return;
}
submitButton.disabled = false;
}
function openPrompt()
{
let numberString = window.prompt("Vnesi dve števili, ločeni z vejico");
if(numberString !== null)
{
let splitNumbersString = numberString.replace(/\s/g,'').split(',');
const N_rows = parseInt(splitNumbersString[0]); //niz 5 --> st. 5
const N_cols = parseInt(splitNumbersString[1]);
let htmlTableFigure = document.getElementById("tableFigure");
htmlTableFigure.innerHTML = "";
if(isNaN(N_rows) || isNaN(N_cols))
{
alert("Neprimeren vnos!");
return;
}
let htmlTable = document.createElement("table");
htmlTable.setAttribute("class", "colorTable");
let htmlTableContent = "";
for(let i = 0; i < N_rows; i++)
{
htmlTableContent += "<tr>"
for(let j = 0; j < N_cols; j++)
{
htmlTableContent += "<td id = 'cell" + String(i) + "|" + String(j) + "'class='cells' onclick='selectTableCell(this.id)'>" + String(i) + "," + String(j) + "</td>";
}
htmlTableContent += "</tr>"
}
htmlTable.innerHTML = htmlTableContent;
htmlTableFigure.appendChild(htmlTable)
}
}
function selectTableCell(tableCellId)
{
const tableCells = document.getElementsByClassName("cells");
for(let i=0; i < tableCells.length; i++)
{
tableCells[i].setAttribute("class", "cells")
}
const selectedCell = document.getElementById(tableCellId);
selectedCell.setAttribute("class", "cells selectedCell");
}

View File

@@ -0,0 +1,120 @@
var usernameInput = null;
var usernameWarningSpan = null;
var passwordInput = null;
var passwprdWarnignSpan = null;
var submitButton = null;
window.onload = (event) =>
{
usernameInput = document.getElementById("usernameInput");
usernameWarningSpan = document.getElementById("usernameWarning")
passwordInput = document.getElementById("passwordInput")
passwordWarnignSpan = document.getElementById("passwordWarning")
submitButton = document.getElementById("submitButton");
console.log(usernameInput);
checkSubmit()
};
function onUsernameChange()
{
console.log(usernameInput.value);
if(/^[a-zA-Z0-9_.,]+$/.test(usernameInput.value)) //ustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "correctInput");
usernameWarningSpan.innerHTML = "Primerno uporavniško ime";
}
else //neustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "incorrectInput");
usernameWarningSpan.innerHTML = "Neprimerno uporavniško ime";
}
checkSubmit()
}
function onPasswordChange()
{
if(/^[a-zA-Z0-9_.,]*[A-Z]+[a-zA-Z0-9_.,]*$/.test(passwordInput.value) && passwordInput.value.length >= 6)
{
passwordWarnignSpan.setAttribute("class", "correctInput")
passwprdWarnignSpan.innerHTML = "Primerno geslo"
}
else
{
passwordWarnignSpan.setAttribute("class", "incorrectInput")
passwprdWarnignSpan.innerHTML = "Neprimerno geslo"
}
checkSubmit()
}
function checkSubmit()
{
const usernameWarningClass = usernameWarningSpan.getAttribute("class");
const passwordWarningClass = passwordWarnignSpan.getAttribute("class");
//ali "incorectInput" ali "CorrectInput"
if(usernameWarningClass == 'IncorrectInput' || passwordWarningClass == 'IncorrectInput')
{
submitButton.disabled = true;
return;
}
submitButton.disabled = false;
}
function openPrompt()
{
let numberString = window.prompt("Vnesi dve števili, ločeni z vejico");
if(numberString !== null)
{
let splitNumbersString = numberString.replace(/\s/g,'').split(',');
const N_rows = parseInt(splitNumbersString[0]); //niz 5 --> st. 5
const N_cols = parseInt(splitNumbersString[1]);
let htmlTableFigure = document.getElementById("tableFigure");
htmlTableFigure.innerHTML = "";
if(isNaN(N_rows) || isNaN(N_cols))
{
alert("Neprimeren vnos!");
return;
}
let htmlTable = document.createElement("table");
htmlTable.setAttribute("class", "colorTable");
let htmlTableContent = "";
for(let i = 0; i < N_rows; i++)
{
htmlTableContent += "<tr>"
for(let j = 0; j < N_cols; j++)
{
htmlTableContent += "<td id = 'cell" + String(i) + "|" + String(j) + "'class='cells' onclick='selectTableCell(this.id)'>" + String(i) + "," + String(j) + "</td>";
}
htmlTableContent += "</tr>"
}
htmlTable.innerHTML = htmlTableContent;
htmlTableFigure.appendChild(htmlTable)
}
}
function selectTableCell(tableCellId)
{
const tableCells = document.getElementsByClassName("cells");
for(let i=0; i < tableCells.length; i++)
{
tableCells[i].setAttribute("class", "cells")
}
const selectedCell = document.getElementById(tableCellId);
selectedCell.setAttribute("class", "cells selectedCell");
}

View File

@@ -0,0 +1,33 @@
html {
min-height: 100%;
height: 100%;
}
body {
min-height: 100%;
height: 100%;
background-color: lightblue;
}
.selectedCell {
background-color: red;
border: 1px solid black;
font-weight: bold;
}
.colorTable * {
border: 1px solid black;
cursor: pointer;
}
#usernameWarning, #passwordWarning {
padding-left: 10px;
}
.correctInput {
color: green;
}
.incorrectInput {
color: darkred;
}

Binary file not shown.

View File

@@ -0,0 +1 @@
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8" 5 <title>Vaja4</title> 6 7 </head> 8 <body onload="checkRadio()"> 9 <table> 10 <form id="login-form" name="formH> 11 <tr> 12 <td><label for="usernameH>Uporabnigko ime:</label></td> 13 <td><input type="text" id="username" oninput="checkUsername()" name="username"><span style=color:red; id="userError"></span></td><br> 14 </tr> 15 16 <tr> 17 <td> <label for="mail">E-pogta:</label> </td> 18 <td> <input type="text" id="mail" oninput="checkMail()" name="mail"><span style=color:red; id="mailError"></span></td> 19 </tr> 20 <tr> 21 <td><label for="pass">Geslo:</label></td> 22 <td><input type="password" id="pass" oninput="checkPassword()" name="pass"><span style=color:red; id="passError"></span></td> 23 </t r> 24 25 <tr> 26 <td><label for="repeatPassH>Ponovi geslo:</label></td> 27 <td><input type="password" id=HrepeatPass" oninput=HcheckRepeatPassword()H name="repeatPass"><span style=color:red; id="repeatPassError"></span></td> 28 </t r> 29 30 <tr> 31 <td><input type="radio" id="gender male" oninput="checkRadio()" name="gender" value="male" Mogki</td> 32 <td><input type="radio" id="gender female" oninput="checkRadio()" name="gender" value="femaleH> 2enski <span style=color:red; id="genderError"></span></td> 33 </t r> 34 <tr> 35 <td> <input type="submit" onclick="checkOnSubmit()" id="submit" value="Poglji"></td> 36 </t r> 37 38 39 </form> 40 </table> 41 42 <script> 43 44 const usernameError = document.getElementById('userError'); 45 const mailError = document.getElementById('mailError'); 46 const passError = document.getElementById('passError'); 47 const repeatPassError = document.getElementById('repeatPassError'); 48 const genderError = document.getElementById('genderError'); 49 50 const username = document.form.username; 51 const mail = document.form.mail; 52 const pass = document.form.pass; 53 const repeatPass = document.form.repeatPass; 54 const gender male = document.form.gender male; 55 const gender female = document.form.gender female; 56 const send = document.form.submit; 57 let error = 0; 58 59 60 61 checkUsername = () => { 62 63 usernameDatabase = ["usernamer, "uporabnik2", "admin", Huporabnik3", "username2"]; 64 65 for(i=0; i<usernameDatabase.length;i++){ 66 if (username.value == usernameDatabase[i]){ 67 usernameError.innerHTML ="Podvojeno ime"; 68 } 69 else{ 70 niPodvojeno = true; 71 } 72 } 73 74 75 if(username.value.length < 3){ 76 usernameError.innerHTML ="Minimalno stevilo znakov je 3!"; 77 uplme=false; 78 } 79 else if(username.value.length >= 3){ 80 usernameError.innerHTML ="Mo6lo uporabnigko ime."; 81 uplme = true; 82 83 } 84 else if(username.value.length > 19){ 85 usernameError.innerHTML ="Predolgo"; 86 uplme= false; 87 } 88 89 } 90 91 //https://www.w3resource.com/javascript/form/email-validation.php 92 93 checkMail = () => { 94 95 if (r\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail.value)) { 96 97 mailError.innerHTML ="Pravilno vpisan mail"; 98 mailFormat = true; 99 } 100 else{ 101 mailError.innerHTML ="Nepravilno vpisan mail"; 102 mailFormat = false; 103 } 104 105 } 106 107 108 checkPassword = () => { 109 if(pass.value.length < 6){ 110 passError.innerHTML ="Minimalno stevilo znakov je 6!H; 111 goodPass = false; 112 } 113 else if (pass.value.search(/[a-z]/) < 0){ 114 passError.innerHTML ="Neustrezno geslo!"; 115 goodPass = false; 116 } 117 else if (pass.value.search(/[A-Z]/) < 0){ 118 passError.innerHTML ="Neustrezno geslo!"; 119 goodPass = false; 120 } 121 else if (pass.value.search(/[0-9]/) < 0){ 122 passError.innerHTML ="Neustrezno geslo!"; 123 goodPass = false; 124 } 125 126 else{ 127 passError.innerHTML ="Ustrezno geslo!"; 128 goodPass = true; 129 } 130 131 } 132 133 134 checkRepeatPassword = () => { 135 136 if(repeatPass.value == pass.value){ 137 repeatPassError.innerHTML=HGesli se ujemata"; 138 repeatedPass = true; 139 } 140 else{ 141 repeatPassError.innerHTML="Gesli se ne ujemata"; 142 repeatedPass = false; 143 144 } 145 } 146 147 148 checkRadio = () => { 149 if (gender male.checked == true gender female.checked == true){ 150 genderError.innerHTML="Pravilne; 151 checkedRadio = true; 152 } 153 154 else { 155 genderError.innerHTML="Nujno izberi!"; 156 checkedRadio = false; 157 } 158 159 } 160 161 checkOnSubmit = () => { 162 if (niPodvojeno == true && uplme == true && mailFormat == true && goodPass == true && repeatedPass == true && checkedRadio == true) { 163 164 window.alert('Podatki so pravilni'); 165 } 166 167 168 else { 169 170 window.alert('Ponovno vpisite podatke.'); 171 window.location.reload(); 172 173 } 174 } 175 176 </script> 177 178 </body> 179 </html>

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="obrazec\obrazec.html">obrazec</a></li>
<li><a href="seznam\seznam.html">seznam</a></li>
<li><a href="izracun.html">izracun</a></li>
</ul>
</nav>
</header>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<html>
<head>
<title>Write example</title>
<script>
let A = parseInt(window.prompt("Vpisi stevilko A"));
let B = parseInt(window.prompt("vpisi stevilko B"));
</script>
</head>
<body>
<table>
<tr>
<th >A:</th>
<th id="A"></th>
</tr>
<tr>
<th >B:</th>
<th id="B"></th>
</tr>
<tr>
<th >Vsota:</th>
<th id="C"></th>
</tr>
<tr>
<th >Razlika:</th>
<th id="D"></th>
</tr>
<tr>
<th >Mnozenje:</th>
<th id="E"></th>
</tr>
<tr>
<th >Deljenje:</th>
<th id="F"></th>
</tr>
<tr>
<th >Ostanek:</th>
<th id="G"></th>
</tr>
<tr>
<th id="H"></th>
</tr>
</table>
<script>
function color(x){
if (x>=0){
return "<span style='color:green; font-weight:bold;'>" + x + "</span>";
}
else{
return "<span style='color:red; font-weight:bold;'>" + x + "</span>";
}
}
if(isNaN(A) || isNaN(B)){
document.getElementById("Table").innerHTML = "<tr> <th> error </th></tr>";
}
else{
document.getElementById("A").innerHTML = color(A);
document.getElementById("B").innerHTML = color(B);
document.getElementById("C").innerHTML = color(A+B);
document.getElementById("D").innerHTML = color(A-B);
document.getElementById("E").innerHTML = color(A*B);
if( B == 0){
document.getElementById("F").innerHTML = "Ni mogoce";
document.getElementById("G").innerHTML = "Ni mogoce";
}
else{
document.getElementById("F").innerHTML = color(A/B);
document.getElementById("G").innerHTML = color(A%B);
}
if(A>B){
document.getElementById("H").innerHTML = "A je vecje B";
}
else if(A == B){
document.getElementById("H").innerHTML = "A je enako B";
}
else{
document.getElementById("H").innerHTML = "A je manjse B";
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<html>
<head>
<title>Write example</title>
<script>
let A = parseInt(window.prompt("Vpisi stevilko A"));
let B = parseInt(window.prompt("vpisi stevilko B"));
</script>
</head>
<body>
<table>
<tr>
<th >A:</th>
<th id="A"></th>
</tr>
<tr>
<th >B:</th>
<th id="B"></th>
</tr>
<tr>
<th >Vsota:</th>
<th id="C"></th>
</tr>
<tr>
<th >Razlika:</th>
<th id="D"></th>
</tr>
<tr>
<th >Mnozenje:</th>
<th id="E"></th>
</tr>
<tr>
<th >Deljenje:</th>
<th id="F"></th>
</tr>
<tr>
<th >Ostanek:</th>
<th id="G"></th>
</tr>
<tr>
<th id="H"></th>
</tr>
</table>
<script>
function color(x){
if (x>=0){
return "<span style='color:green; font-weight:bold;'>" + x + "</span>";
}
else{
return "<span style='color:red; font-weight:bold;'>" + x + "</span>";
}
}
if(isNaN(A) || isNaN(B)){
document.getElementById("Table").innerHTML = "<tr> <th> error </th></tr>";
}
else{
document.getElementById("A").innerHTML = color(A);
document.getElementById("B").innerHTML = color(B);
document.getElementById("C").innerHTML = color(A+B);
document.getElementById("D").innerHTML = color(A-B);
document.getElementById("E").innerHTML = color(A*B);
if( B == 0){
document.getElementById("F").innerHTML = "Ni mogoce";
document.getElementById("G").innerHTML = "Ni mogoce";
}
else{
document.getElementById("F").innerHTML = color(A/B);
document.getElementById("G").innerHTML = color(A%B);
}
if(A>B){
document.getElementById("H").innerHTML = "A je vecje B";
}
else if(A == B){
document.getElementById("H").innerHTML = "A je enako B";
}
else{
document.getElementById("H").innerHTML = "A je manjse B";
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
span {
padding-left: 10px;
}
.correctInput {
color: green;
}
.incorrectInput {
color: darkred;
}

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="sl">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="obrazec.css">
<script src="obrazec.js"></script>
</head>
<body>
<div>
<form method="GET" action="index.html">
<label>Uporabniško ime</label><br>
<input id="uporabniskoIme" type="text" oninput="onUsernameChange()">
<span id="uporabniškoImeUpozorilo" class="incorrectInput">Neprimerno uporabniško ime</span><br>
<label>Email</label><br>
<input id="Email" type="text" oninput="onEmailChange()">
<span id="EmailUpozorilo" class="incorrectInput">Neprimerni Email</span><br>
<label>Geslo</label><br>
<input id="Geslo" type="password" oninput="onPasswordChange()">
<span id="GesloUpozorilo" class="incorrectInput">Neprimerno geslo</span><br>
<label>Ponovi geslo</label><br>
<input id="Geslo1" type="password" oninput="onPassword1Change()">
<span id="Geslo1Upozorilo" class="incorrectInput">Geslo ni isto</span><br>
<label>Spol</label><br>
<span><input type="radio" name="spol" id="SpolMoski" oninput="onSpolChange()">Moški</span>
<span><input type="radio" name="spol" id="SpolZenski" oninput="onSpolChange()">Ženski</span>
<span id="SpolUpozorilo" class="incorrectInput">Izberi spol</span><br>
<br><input id="submitButton" type="submit">
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,127 @@
var uporabniskoIme = null;
var uporabniškoImeUpozorilo = null;
var Email = null;
var EmailUpozorilo = null;
var Geslo = null;
var GesloUpozorilo = null;
var Geslo1 = null;
var Geslo1Upozorilo = null;
var SpolMoski = null;
var SpolZenski = null;
var SpolUpozorilo = null;
var submitButton = null;
let imena = ['Nikola','Peter','Aljaz','Nik','David'];
window.onload = (event) =>{
uporabniskoIme = document.getElementById("uporabniskoIme");
uporabniškoImeUpozorilo = document.getElementById("uporabniškoImeUpozorilo");
Email = document.getElementById("Email");
EmailUpozorilo = document.getElementById("EmailUpozorilo");
Geslo = document.getElementById("Geslo");
GesloUpozorilo = document.getElementById("GesloUpozorilo");
Geslo1 = document.getElementById("Geslo1");
Geslo1Upozorilo = document.getElementById("Geslo1Upozorilo");
SpolMoski = document.getElementById("SpolMoski");
SpolZenski= document.getElementById("SpolZenski");
SpolUpozorilo= document.getElementById("SpolUpozorilo");
submitButton = document.getElementById("submitButton");
checkSubmit()
};
function onUsernameChange(){
if(/^[a-zA-Z0-9_.,]{3,20}$/.test(uporabniskoIme.value) && !imena.includes(uporabniskoIme.value)){
uporabniškoImeUpozorilo.setAttribute("class", "correctInput");
uporabniškoImeUpozorilo.innerHTML = "Primerno uporavniško ime";
}
else{
uporabniškoImeUpozorilo.setAttribute("class", "incorrectInput");
uporabniškoImeUpozorilo.innerHTML = "Neprimerno uporavniško ime";
}
checkSubmit()
}
function onEmailChange(){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Email.value)){
EmailUpozorilo.setAttribute("class", "correctInput");
EmailUpozorilo.innerHTML = "Primerni Email";
}
else{
EmailUpozorilo.setAttribute("class", "incorrectInput");
EmailUpozorilo.innerHTML = "Neprimerni Email";
}
checkSubmit()
}
function onPasswordChange(){
if(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,}$/.test(Geslo.value))
{
GesloUpozorilo.setAttribute("class", "correctInput");
GesloUpozorilo.innerHTML = "Primerno geslo";
}
else
{
GesloUpozorilo.setAttribute("class", "incorrectInput");
GesloUpozorilo.innerHTML = "Neprimerno geslo";
}
checkSubmit()
}
function onPassword1Change(){
if(Geslo1.value == Geslo.value){
Geslo1Upozorilo.setAttribute("class", "correctInput");
Geslo1Upozorilo.innerHTML = "Geslo je isto";
}
else{
Geslo1Upozorilo.setAttribute("class", "incorrectInput");
Geslo1Upozorilo.innerHTML = "Geslo ni isto";
}
checkSubmit()
}
function onSpolChange(){
if(SpolMoski.checked == true || SpolZenski.checked == true){
SpolUpozorilo.setAttribute("class", "correctInput");
SpolUpozorilo.innerHTML = "Vredu";
}
else{
SpolUpozorilo.setAttribute("class", "incorrectInput");
SpolUpozorilo.innerHTML = "Izberi spol";
}
checkSubmit()
}
function checkSubmit(){
const ImeUpozoriloClass = uporabniškoImeUpozorilo.getAttribute("class");
const EmailUpozoriloClass = EmailUpozorilo.getAttribute("class");
const GesloUpozoriloClass = GesloUpozorilo.getAttribute("class");
const Geslo1UpozoriloClass = Geslo1Upozorilo.getAttribute("class");
const SpolUpozoriloClass = SpolUpozorilo.getAttribute("class");
if(ImeUpozoriloClass == 'IncorrectInput' || EmailUpozoriloClass == 'IncorrectInput' || GesloUpozoriloClass == 'IncorrectInput' || Geslo1UpozoriloClass == 'IncorrectInput' || SpolUpozoriloClass == 'IncorrectInput'){
submitButton.disabled = true;
}
else{
submitButton.disabled = false;
}
}

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<script src="seznam.js"></script>
<style>
.selectedDiv{
border: 1px solid red;
}
</style>
</head>
<body onload="openPrompt()">
<div id="A" style="text-align: center; ">Klikni me</div>
</body>
</html>

View File

@@ -0,0 +1,33 @@
let R = parseInt(window.prompt("Vpisi stevilko R"));
let G = parseInt(window.prompt("Vpisi stevilko G"));
let B = parseInt(window.prompt("Vpisi stevilko B"));
let velikost = parseInt(window.prompt("Vpisi stevilko Velikost"));
let r = R/velikost;
let g = G/velikost;
let b = B/velikost;
function openPrompt(){
let barva = document.getElementById("A");
let block = "";
let i;
for(i = 0; i <= velikost; i++){
block += "<div class='Div' id='" + String(i) + "' style=' color: rgb(" + String(255-R) + "," + String(255-G) + "," + String(255-B) +"); background-color: rgb(" + String(R) + "," + String(G) + "," + String(B) + ");' onclick='selectDiv(this.id)'>rgb(" + String(R) + "," + String(G) + "," + String(B) + ")</div>";
R = R-r;
G = G-g;
B = B-b;
}
barva.innerHTML = block;
}
function selectDiv(DivId)
{
const Div = document.getElementsByClassName("Div");
for(let i=0; i < velikost; i++)
{
Div[i].setAttribute("class", "Div")
}
const selectedDiv = document.getElementById(DivId);
selectedDiv.setAttribute("class", "Div selectedDiv");
}

View File

@@ -0,0 +1,68 @@
var uporabniskoIme = null;
var usernameWarningSpan = null;
var passwordInput = null;
var passwprdWarnignSpan = null;
var submitButton = null;
window.onload = (event) =>
{
uporabniskoIme = document.getElementById("uporabniskoIme");
usernameWarningSpan = document.getElementById("usernameWarning")
passwordInput = document.getElementById("passwordInput")
passwprdWarnignSpan = document.getElementById("passwordWarning")
submitButton = document.getElementById("submitButton");
checkSubmit()
};
function onUsernameChange()
{
if(/^[a-zA-Z0-9_.,]+$/.test(uporabniskoIme.value)) //ustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "correctInput");
usernameWarningSpan.innerHTML = "Primerno uporavniško ime";
}
else //neustrezno uporabnisko ime
{
usernameWarningSpan.setAttribute("class", "incorrectInput");
usernameWarningSpan.innerHTML = "Neprimerno uporavniško ime";
}
checkSubmit()
}
/*^[a-zA-Z0-9_.,]*[A-Z]+[a-zA-Z0-9_.,]*$ */
function onPasswordChange()
{
if(/^[a-zA-Z0-9_.,]+$/.test(passwordInput.value) && passwordInput.value.length >= 6)
{
passwprdWarnignSpan.setAttribute("class", "correctInput");
passwprdWarnignSpan.innerHTML = "Primerno geslo";
}
else
{
passwprdWarnignSpan.setAttribute("class", "incorrectInput");
passwprdWarnignSpan.innerHTML = "Neprimerno geslo";
}
checkSubmit()
}
function checkSubmit()
{
const usernameWarningClass = usernameWarningSpan.getAttribute("class");
const passwordWarningClass = passwordWarnignSpan.getAttribute("class");
//ali "incorectInput" ali "CorrectInput"
if(usernameWarningClass == 'IncorrectInput' || passwordWarningClass == 'IncorrectInput')
{
submitButton.disabled = true;
return;
}
submitButton.disabled = false;
}

View File

@@ -0,0 +1,33 @@
html {
min-height: 100%;
height: 100%;
}
body {
min-height: 100%;
height: 100%;
background-color: lightblue;
}
.selectedCell {
background-color: red;
border: 1px solid black;
font-weight: bold;
}
.colorTable * {
border: 1px solid black;
cursor: pointer;
}
#usernameWarning, #passwordWarning {
padding-left: 10px;
}
.correctInput {
color: green;
}
.incorrectInput {
color: darkred;
}