|
@@ -1,110 +0,0 @@
|
|
|
-<!DOCTYPE html>
|
|
|
-<html lang="en">
|
|
|
-<head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
|
- <title>Document</title>
|
|
|
- <style type="text/css">
|
|
|
- label{
|
|
|
- display: inline-block;
|
|
|
- width:80px;
|
|
|
- margin-top: 15px;
|
|
|
- }
|
|
|
- input{
|
|
|
- margin-top: 15px;
|
|
|
- }
|
|
|
- </style>
|
|
|
-</head>
|
|
|
-<body>
|
|
|
- <select id="citySelect"></select>
|
|
|
- <form action="#">
|
|
|
- <div id="myDiv">
|
|
|
- <label for="name"> Login: </label>
|
|
|
- <input type="text" name="Name" placeholder="Enter your Login" id="name">
|
|
|
- <br>
|
|
|
- <label for="password"> Password: </label>
|
|
|
- <input type="password" name="password" placeholder="Enter your password" id="password">
|
|
|
- <br>
|
|
|
- <!-- button -->
|
|
|
- <input type="button" name="Login" value="Login" onclick="ClickLogin()">
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- <script type="text/javascript">
|
|
|
-
|
|
|
-//1.
|
|
|
-var a = {
|
|
|
-name:"Donald",
|
|
|
-surname:"Trump"}
|
|
|
-var b = {
|
|
|
-name:"Donald",
|
|
|
-surname:"Trump"}
|
|
|
-undefined
|
|
|
-var c = {
|
|
|
-name:"Donald",
|
|
|
-surname:"Trump"}
|
|
|
-
|
|
|
-//2.
|
|
|
-a.age = 98;
|
|
|
-b.fathername = "Bob"
|
|
|
-c.sex = "male"
|
|
|
-
|
|
|
-//3.
|
|
|
-if ("age" in a)
|
|
|
-{alert(a.age)}
|
|
|
-else {if ("fathername" in a)
|
|
|
-{alert(a.fathername)}
|
|
|
-else{
|
|
|
-if ("sex" in a)
|
|
|
-{alert(a.sex)}}
|
|
|
- }
|
|
|
-if ("age" in b)
|
|
|
-{alert(b.age)}
|
|
|
-else {if ("fathername" in b)
|
|
|
-{alert(b.fathername)}
|
|
|
-else{
|
|
|
-if ("sex" in b)
|
|
|
-{alert(b.sex)}}
|
|
|
- }
|
|
|
-if ("age" in c)
|
|
|
-{alert(c.age)}
|
|
|
-else {if ("fathername" in c)
|
|
|
-{alert(c.fathername)}
|
|
|
-else{
|
|
|
-if ("sex" in c)
|
|
|
-{alert(c.sex)}}
|
|
|
- }
|
|
|
-
|
|
|
-//4.
|
|
|
-var person = [a, b,c,{name:"IA", surname:"YA"}]
|
|
|
-
|
|
|
-//5.
|
|
|
-for (var i=0; i<person.length;i++){console.log(person[i])}
|
|
|
-
|
|
|
-//6.
|
|
|
-for (var i=0; i<person.length;i++){console.log("name: " + person[i].name);
|
|
|
-console.log("surname: " + person[i].surname)}
|
|
|
-
|
|
|
-//7.
|
|
|
-for (var value of person){
|
|
|
-for (var key in value){ console.log(value[key])}
|
|
|
-}
|
|
|
-
|
|
|
-//8.
|
|
|
-for (var value of person){
|
|
|
-if("name" in value && "surname" in value){value.fullName = prompt("enter fullName")}
|
|
|
-}
|
|
|
-
|
|
|
-//9.
|
|
|
-JSON.stringify(person)
|
|
|
-
|
|
|
-//10.
|
|
|
-person.push(JSON.parse(`{"name":"AAA","surname":"BBB","age":11,"fullName":"AABB"}`))
|
|
|
-
|
|
|
-//11.
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- </script>
|
|
|
-</body>
|
|
|
-</html>
|