<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js" type="text/javascript"></script>
<script src="SimulationSoftware.js"></script>
<script>
var SimulationName = [];
for (var propName in SimulationSoftwareData)
SimulationName.push(propName);
function UserViewModel(id, simulations, fields, icon) {
var self = this;
self.id = id;
self.simulations = ko.observableArray(SimulationName);
self.simulation = ko.observable();
self.fields = ko.computed(function () {
var areaData = SimulationSoftwareData[self.simulation()];
var options = [];
if (areaData) {
for (var propName in areaData) {
options.push({
value: propName,
text: propName
});
}
}
return options;
});
if(fields=="國語"){
self.icon = [
{ t: "甲", v: "甲" },
{ t: "乙", v: "乙" },
{ t: "丙", v: "丙" },
{ t: "丁", v: "丁" }
];
}
if(fields=="英語"){
self.icon = [
{ t: "A", v: "A" },
{ t: "B", v: "B" },
{ t: "C", v: "C" }
];
}
else{
self.icon = [
{ t: "1", v: "1" },
{ t: "2", v: "2" },
{ t: "3", v: "3" }
];
}
self.icons = ko.observable("");
self.areaZip = ko.observable();
}
function MyViewModel() {
var self = this;
self.users = ko.observableArray();
self.removeUser = function (user) {
self.users.remove(user);
}
}
$(function () {
var vm = new MyViewModel();
var c = 1;
$("#btnAddUser").click(function () {
vm.users.push(new UserViewModel(
c++,
self.simulation = self.simulations,
self.areaZip = self.fields));
});
ko.applyBindings(vm);
});
</script>
<style type="text/css">
.styleW25
{
width: 25px;
}
.styleW100
{
width: 100px;
}
</style>
</head>
<body>
<input type="button" value="Add" id="btnAddUser" />
共 <span data-bind="text: users().length"></span> 筆
<table id="addtable" border="1" cellpadding="3" style="border:1px #000000 solid;text-align:center;width: 1332px;">
<thead>
<tr><th class="styleW25">No.</th>
<th class="styleW100">主分類<span class="auto-style13">*</span></th>
<th class="styleW100">次分類<span class="auto-style13">*</span></th>
<th class="styleW100">次次分類<span class="auto-style13">*</span></th>
</thead>
<tbody data-bind="foreach: users">
<tr>
<td class="styleW25"><span class="styleW25" data-bind="text: id" ></span></td>
<td class="styleW100"><select required class="styleW100" name ="SimulationName" data-bind="options: simulations, optionsCaption: '請選主分類', value: simulation"></select></td>
<td class="styleW100"><select required class="styleW100" name ="FieldName" data-bind="options: fields, optionsCaption: '請選擇次分類', optionsText: 'text', optionsValue: 'value', value: areaZip"></select></td>
<td class="styleW100"><select required class="styleW100" name="AnalysisProject" data-bind="options: icon, optionsCaption: '請選擇次次分類', optionsText: 't', optionsValue: 'v', value: icons"></select></td>
</tr>
</tbody>
</table>
</body>
</html>
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |