consolidate all repos to one for archive
This commit is contained in:
1
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/demo.html
Normal file
1
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/demo.html
Normal 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>
|
20
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/index.html
Normal file
20
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/index.html
Normal 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>
|
87
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/izracun.html
Normal file
87
semester_1/uvod_v_svetovni_splet/Vaja_4/Naloga/izracun.html
Normal 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>
|
@@ -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>
|
@@ -0,0 +1,11 @@
|
||||
span {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.correctInput {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.incorrectInput {
|
||||
color: darkred;
|
||||
}
|
@@ -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>
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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>
|
@@ -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");
|
||||
}
|
Reference in New Issue
Block a user