html
html
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
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body id = "body">
<h1 id = "par">Hello!</h1><br />
<br /><br /><br />
<div id = "box">
<br />
<p>This is an alert box</p><br />
<span id = "back" onclick = "recede()">Back</span>
<span id = "ok" onclick = "ahead()">Ok</span>
</div>
<script>
var ok = document.getElementById ("ok");
var back = document.getElementById ("back");
var box = document.getElementById ("box");
var body = document.getElementById ("body");
var par = document.getElementById ("par");
function ahead(){
body.removeChild(box);
par.innerHTML = "Welcome to Sololearn!";
body.style.backgroundColor = "#ffffff";
}
function recede(){
x = confirm("Are you sure want to exit?");
Enter to Rename, Shift+Enter to Preview
css
css
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
body {
background-color: #cccccc;
}
div {
background-color: gray;
height: 200px;
border-radius: 25px;
color: white;
font-size: 1.6em;
text-align: center;
}
#back {
background-color: red;
width: 100px;
position: absolute;
left: 50px;
}
#ok {
background-color: green;
width: 100px;
position: absolute;
left: 200px;
}
#par {
color: royalblue;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run