Andrey Yakovlev 7 роки тому
батько
коміт
4cfa9adc3e

+ 22 - 0
TROUBLEjs00/aad.js

@@ -0,0 +1,22 @@
+
+
+window.onload=function() {document.getElementById('button').onclick=function a() {
+	showhide('tr', 'fl', this);
+};
+var login =  document.reg.login.value;
+	var password = document.reg.password.value;
+var bst = {
+ login: 'admin', password: 'qwerty',
+};
+
+
+function showhide(a, b, c) {
+	var l=document.getElementById(c);
+	if (login===bst['login'] && password===bst['password'])
+ {var i=document.getElementById('tr');
+i.hidden=false
+}
+else if (login!==bst['login'] && password!==bst['password'])
+	{var v=document.getElementById('fl');
+v.hidden=false; }
+}}

+ 46 - 0
TROUBLEjs00/c.html

@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head><title>Проверка пороля</title>
+<form action="" name="forma_1">
+<b>Ввведите имя:    </b>
+
+<input type="text" maxlength="10" size="11" name="login" value="">
+
+
+
+<b>Введите пароль: </b>
+<input type="password" maxlength="10" size="11" name="parol" value="">
+
+
+
+<input type="button" value="ОтПрАвИтЬ" onClick='print()'>
+</form>
+<script language="javascript">
+<!--
+var logins=new Array('1', '2', '3', '4', '5');
+var parols=new Array('5', '4', '3', '2', '1');
+
+function print()
+{
+var log=document.forma_1.login.value;
+var par=document.forma_1.parol.value;
+
+  for (i=0; i<logins.length; i++)
+  {
+	if (logins[i]==log && parols[i]==par) {alert('Вы вошли как ' + logins[i]); break}
+	else if (i==logins.length-1) {alert('Данные не верны'); document.forma_1.login.value=''; document.forma_1.parol.value=''}
+  }
+
+}
+//-->
+</script>
+
+	<meta charset="UTF-8">
+	<title>	</title>
+</head>
+<body>
+	
+</body>
+</html>
+
+

+ 32 - 0
TROUBLEjs00/f.html

@@ -0,0 +1,32 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+</head>
+<body>
+
+<a id="toggler" href="#">Открыть</a>
+<div id="box" style="display: none;">Отображаемый блок</div>
+<script type="text/javascript">
+	window.onload= function() {
+	document.getElementById('toggler').onclick = function() {
+		openbox('box', this);
+		
+	};
+};
+function openbox(id, toggler) {
+	var div = document.getElementById(id);
+	if(div.style.display == 'block') {
+		div.style.display = 'none';
+		
+	}
+	else {
+		div.style.display = 'block';
+		
+	}
+}
+</script>
+</body>
+</html>

+ 31 - 0
TROUBLEjs00/index.html

@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+	<script src="script.js"></script>
+</head>
+<body>
+<style>
+.a {
+
+width: 30vh;
+height: 30vh;
+background: green;
+}
+.b {
+width: 30vh;
+height: 30vh;
+background: red;
+}
+</style>
+	<form name="reg" action="">
+		<input id="s" name="login" type="text">
+		<input id="f" name="password" type="password">
+		<input type="submit" onclick="Name()">
+	</form>
+<div id="tr" class="a" hidden>позравляю</div>
+<div id="fl" class="b" hidden>ошибочка</div>
+
+</body>
+</html>

+ 15 - 0
TROUBLEjs00/script.js

@@ -0,0 +1,15 @@
+function Name() {
+	var login =  document.getElementById('s').value;
+	var password = document.getElementById('f').value;
+var bst = {
+    login: 'admin', password: 'qwerty',
+};
+
+if (login===bst['login'] && password===bst['password'])
+ {var i=document.getElementById('tr');
+i.hidden=false
+}
+else if (login!==bst['login'] && password!==bst['password'])
+	{var v=document.getElementById('fl');
+v.hidden=false; }
+};

+ 29 - 0
TROUBLEjs00/v.html

@@ -0,0 +1,29 @@
+<html>
+<head>
+</head>
+ 
+<body>
+
+
+<div id='first'>first</div>
+<div id='second' style="display: none">second</div>
+<a id="back">back</a>
+<a id="forward">forward</a>
+
+
+<script>
+get=document.querySelector.bind(document)
+first=get("#first")
+second=get("#second")
+f=function(){
+ if(this.id==="back") {
+   first.style.display="block"; second.style.display="none"
+ }else{
+   first.style.display="none"; second.style.display="block"
+ }
+}
+;[get("#back"), get("#forward")].forEach(function(e){e.onclick=f})
+</script>
+</body>
+ 
+</html>

+ 11 - 0
TROUBLEjs04/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+	<script src="script.js"></script>
+</head>
+<body>
+	
+</body>
+</html>

+ 9 - 0
TROUBLEjs04/script.js

@@ -0,0 +1,9 @@
+for(var i =0; i<10; ++i){
+var str='';
+for(var j =0; j<10; ++j){
+str+=j;
+toString:var m = str+'\n';
+}
+b(m);
+}
+function b(m) { document.write(m);}

+ 1 - 1
js01/script.js

@@ -12,6 +12,6 @@ function Func() {
 	alert('Ваш подъезд: '+aa);
 	var b = aaa*pod;
 	c = uflat -b;
-	d =  parseInt(c /flats) ;
+	d =  parseInt(c /flats) +1;
 	alert('Ваш этаж: '+d);
 };

+ 12 - 0
js02/index.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+	<script src="script.js"></script>
+
+</head>
+<body>
+	
+</body>
+</html>

+ 15 - 0
js02/script.js

@@ -0,0 +1,15 @@
+var type = prompt('Валюта', "");
+var type1=type.toLowerCase();
+var howM =  prompt('Кол-во рідних гривень', "");
+var howM1= parseInt(howM);
+var kurs = {
+    usd: 25.6,
+    eur: 29
+};
+
+if (type1=="usd") {
+alert( howM1/kurs['usd'])
+} ;
+if (type1=="eur") {
+alert( howM1/kurs['eur'])
+} ;

+ 18 - 0
js03/index.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Egypt-StoneCutPapirus</title>
+	<script src="script.js"></script>
+</head>
+<body>
+	
+
+	<p>We have three sides: "Stone", "Scissor" and "Papirus"</p>
+	<p>Choose your side:</p>
+	<form action="">
+	<input id="j" type="text" >
+	<input type="submit" id='post' onclick="fub()" value='Start a fight'>
+	</form>
+</body>
+</html>

+ 24 - 0
js03/script.js

@@ -0,0 +1,24 @@
+function fub() {
+	var use= document.getElementById('j').value;
+	var user =use.toLowerCase();
+ var g= Math.floor(Math.random() * (46- 50 + 1)) + 50;
+user=='stone'&&g==49?alert('We havn\'t winner. I\'m also a stone!'):
+user=='stone'&&g==47 ?alert('You are the winner'):
+user=='stone'&&g==48 ?alert('I am the winner'):
+user=='scissor'&&g==48 ?alert('We havn\'t winner. I\'m also a scissor!'):
+user=='scissor'&&g==47 ?alert('You are the winner'):
+user=='scissor'&&g==49 ?alert('I am the winner'):
+user=='papirus'&&g==47 ?alert('We havn\'t winner. I\'m also a papirus!'):
+user=='papirus'&&g==48 ?alert('You are the winner'):
+user=='papirus'&&g==49 ?alert('I am the winner'):alert('We havn\'t this side!');
+}
+
+ /*
+}
+fuck, where is my Internet, faggots?
+ 	49=stone
+	48=cut
+	47=papirus
+ 	stone >  cut > papirus
+	stone < papirus < cut
+	cut < stone < papirus*/

+ 11 - 0
js05/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Table</title>
+	<script src="script.js"></script>
+</head>
+<body>
+
+</body>
+</html>

+ 14 - 0
js05/script.js

@@ -0,0 +1,14 @@
+
+for (var i=1;i<10;i++){
+	
+	var str =  ''  ;
+	for (j=1;j<10;j++){
+
+		var k=i*j;
+		str += '<td>' +i+'*' + '<td>'+ ' <td>'+ j+'='+k+ '</td>' ;
+
+	}
+	b(str);
+}
+
+function b(str) { document.write('<table>','<tr>',str, '</tr>' ,'</table>');}

+ 11 - 0
js06/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+	<script src="script.js"></script>
+</head>
+<body>
+	
+</body>
+</html>

+ 9 - 0
js06/script.js

@@ -0,0 +1,9 @@
+	var y=3;
+	var i=0;
+		
+	while(y){
+	
+		i+=1;
+		alert(i);
+		if (Math.random() > 0.9)break; {}
+	}

+ 11 - 0
js07/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8">
+	<title>Document</title>
+	<script src="script.js"></script>
+</head>
+<body>
+	
+</body>
+</html>

+ 9 - 0
js07/script.js

@@ -0,0 +1,9 @@
+	var y=3;
+	var i=0;
+		
+	while(y){
+	
+		i+=1;
+		alert(i);
+		if (Math.random() > 0.9)break; {}
+	}