-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDelta1.html
More file actions
75 lines (75 loc) · 2.17 KB
/
Delta1.html
File metadata and controls
75 lines (75 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<title>Sesh</title>
</head>
<style type="text/css">
textarea[name="newta"]{
color: blue;
background: black;
text-align: left;
font-family: cursive;
font-size: 200%;
text-align: center;
}
#save{
background-color:red;
color:black;
margin-left: 45%;
font-size: 16px;
padding: 16px 32px;
}
button.but{
padding: 30px 30px;
text-align: center;
font-size: 200%;
margin-left :20%;
color:blue;
text-shadow: 2px 2px 2px black;
}
</style>
<body style="background-color:pink">
<h1 style="font-family: impact;font-size:300%;border:outset;color: black;background-color: red;text-align: center;padding: 20px 20px">Notes</h1>
<button class="but" onclick="create()">Create a text Area</button>
<button class="but" onclick="delet()">Delete</button>
<button onclick="Save()" id="save" >Save</button>
<script type="text/javascript">
function create() {
var textar=document.createElement("textarea");
var t=document.createTextNode("Type your text here...");
textar.appendChild(t);
textar.cols=70;
textar.rows=10;
textar.name="newta";
document.body.appendChild(textar);
}/*
<button class="but"onclick="change()">Change</button>
function change(){
var x=prompt("Which element do you want to change?");
var y=document.getElementsByName("newta");
if(x>y.length){
var x=prompt("Choose a number between 1 and "+ y.length);
}
document.getElementsByName("newta")[x-1].style.background="red";
//document.get....().value gives the content(whatever is written inside)
}*/
function delet(){
var x=prompt("Which element do you want to delete?");
var y=document.getElementsByName("newta");
if(x>y.length){
var x=prompt("Choose a number between 1 and "+ y.length);
}
document.getElementsByName("newta")[x-1].remove();
}
function Save() {
if(document.getElementsByName("newta")[0].value!=='')
window.alert("Your Document has been updated!");
else
window.alert("Your document is empty. Do you want to continue?")
//local storage(not working)
//localStorage.setItem("New",document.getElementById("Sesh").innerHTML);
//document.getElementById("result").innerHTML=localStorage.getItem("New");
}
</script>
</body>
</html>