forked from rohansh1997/SAP-Hackathon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformjavascript.js
More file actions
23 lines (20 loc) · 885 Bytes
/
formjavascript.js
File metadata and controls
23 lines (20 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var data = {
"Artifact" : ["Sword Of Gryffindor", "Golden Snitch","Marauder Map","Mirror of Erised","Invisibilty Cloak"],
"Utility" : ["Pensieve", "Remembrall","The Monster Book Of Monsters","Wizard Chess"],
"Transport" : ["Broom Stick","Hogwarts Express"]
};
window.onload = function () {
var productType = document.getElementById("productTypeSel");
var subProductType = document.getElementById("subTypeSel");
for (var product in data){
productType.options[productType.options.length] = new Option(product,product);
}
productType.onchange = function(){
subProductType.length = 1;
if(this.selectedIndex < 1)
return;
for (var subType in data[this.value]){
subProductType.options[subProductType.options.length] = new Option(data[this.value][subType],data[this.value][subType]);
}
}
}