-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment6.html
45 lines (45 loc) · 1.66 KB
/
experiment6.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!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>
<script>
function stateChange(){
var x = document.getElementById("st").value
var In = document.getElementById("capital").innerHTML
if (x === "cg"){
document.getElementById("capital").innerHTML = "Chhattisgarh capital is Raipur"
}else if(x === "mp") {
document.getElementById("capital").innerHTML = "Madhya pradesh capital is Bhopal"
}else if(x === "os") {
document.getElementById("capital").innerHTML = "Orissa capital is Bhubaneswar"
}else if(x === "up") {
document.getElementById("capital").innerHTML = "Uttar Pradesh capital is Lucknow"
}else if(x === "gj") {
document.getElementById("capital").innerHTML = "Gujrat capital is Gandhinagar"
}
}
</script>
<style>
#capital{
font-family: 'Times New Roman', Times, serif;
color: royalblue;
}
</style>
</head>
<body>
<h1>Select state for Capital </h1>
<form action="post">
<select name="state" id="st" onchange="stateChange()">
<option value="cg">Chhattisgarh</option>
<option value="mp">Madhya pradesh</option>
<option value="os">Orissa</option>
<option value="up">Uttar Pradesh</option>
<option value="gj">Gujrat</option>
</select>
</form>
<h1 id="capital"></h1>
</body>
</html>