<!DOCTYPE html>
<
html
>
<
head
>
<
script
type
=
"text/javascript"
>
function populate(s, s1) {
let s = document.getElementById(s);
let s1 = document.getElementById(s1);
s1.innerHTML = "";
if(s.value == "Database") {
let arr = ["|Select","mysql|MySQL","oracle|Oracle"];
}
for(let option in arr) {
let pair = arr[option].split("|");
let new_op = document.createElement("option");
new_op.value = pair[0];
new_op.innerHTML = pair[1];
s1.options.add(new_op);
}
}
</
script
>
<
style
>
body {
text-align:center;
}
h1 {
color:green;
}
</
style
>
</
head
>
<
body
>
<
h1
>GeeksforGeeks</
h1
>
<
h2
>Choose Subject:</
h2
>
<
select
id
=
"slct"
name
=
"slct"
onchange
=
"populate(this.id, 'slct1')"
>
<
option
value
=
""
>Select</
option
>
<
option
value
=
"Database"
>Database</
option
>
<
option
value
=
"Java"
>Java</
option
>
<
option
value
=
"Python"
>Python</
option
>
</
select
>
<
h2
>Choose topics:</
h2
>
<
select
id
=
"slct1"
name
=
"slct1"
></
select
>
</
body
>
</
html
>