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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| <!DOCTYPE html>
<html lang="en">
<head>
<title>FP30 playground webmidi</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="https://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<style>
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: minmax(10px, auto);
}
.box1 {
grid-column-start: 1;
grid-column-end: 4;
grid-row-start: 1;
grid-row-end: 3;
}
.box2 {
grid-column-start: 1;
grid-row-start: 2;
grid-row-end: 4;
}
</style>
<script>
function addCheckbox(){
for (var i = 0; i < getCount(myjson.voice); i++) {
var newInput = document.createElement('input');
newInput.type = "radio";
newInput.name = "radio-choice-1";
newInput.id = "radio-mii-" + i;
newInput.value = "choice-" + i;
newInput.width="10";
newInput.checked="checked";
var newLabel = document.createElement('label');
newLabel.textContent = myjson.voice[i].content;
newLabel.htmlFor = newInput.id;
console.log(newInput);
console.log(newLabel);
document.getElementById("wrapper1").appendChild(newInput);
document.getElementById("wrapper1").appendChild(newLabel);
}
}
/* Necessaire pour la fonction addLinks */
function getCount(obj) {
var count = 0,
prop;
for (prop in obj) {
if (obj.hasOwnProperty(prop) && prop !== "average_age" && prop !== "count") {
count += 1;
}
}
return count;
}
</script>
</head>
<body onload="addCheckbox();">
// exemple de checkbox correxctement affichées
<div class="wrapper" id="wrapper1">
<input type="radio" name="radio-choice-1" id="radio-mii-10" value="choice-10" checked="checked" width="10"/>
<label for="radio-mii-10">Credit</label>
<input type="radio" name="radio-choice-1" id="radio-mini-12" value="choice-12" />
<label for="radio-mini-12">Debit</label>
<input type="radio" name="radio-choice-1" id="radio-mini-13" value="choice-13" />
<label for="radio-mini-13">Cash</label>
</div>
</body>
</html>
<script>
var myjson=
{
"voice":
[
{
"Set": "Roland",
"Category": " Piano",
"PC": "1",
"MSB": "0",
"LSB": "68",
"content": "Concert Piano(GP1)"
},
{
"Set": "Roland",
"Category": " Piano",
"PC": "1",
"MSB": "16",
"LSB": "67",
"content": "Ballad Piano(GP2)"
},
{
"Set": "Roland",
"Category": " Piano",
"PC": "2",
"MSB": "8",
"LSB": "66",
"content": "Bright Piano(GP3)"
},
{
"Set": "Roland",
"Category": " Piano",
"PC": "1",
"MSB": "4",
"LSB": "64",
"content": "Mellow Piano"
}
]
}
</script> |
Partager