-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
57 lines (57 loc) · 2.12 KB
/
index.html
File metadata and controls
57 lines (57 loc) · 2.12 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>JSON</h1>
</div>
<div class="row">
<form action="jsonToGsonClass.php" target="result">
<div class="col-sm-6">
<textarea class="form-control" name="code_block" id="code_block" cols="30" rows="10"></textarea>
<hr>
<input class="btn btn-lg btn-success" type="submit">
</div>
<div class="col-sm-6">
<div id="output"></div>
</div>
</form>
</div>
<hr>
<iframe name="result" frameborder="0" width="100%"></iframe>
<script>
var block = document.getElementById('code_block');
var output = document.getElementById('output');
block.onkeyup = function(e) {
output.innerHTML = '';
json = JSON.parse(block.value)
for(var i in json){
var checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.name = i;
checkbox.checked = true;
var text = document.createTextNode(" " + i);
var select = document.createElement('select');
select.type = 'select';
select.className = 'form-control';
select.name = 'select_' + i;
select.add(new Option('String', 'String'));
select.add(new Option('int', 'int'));
select.add(new Option('double', 'double'));
select.add(new Option('float', 'float'));
select.add(new Option('long', 'long'));
output.appendChild(checkbox);
output.appendChild(text);
output.appendChild(select);
output.appendChild(document.createElement('br'))
}
}
</script>
</div>
</body>
</html>