Template:Team:Amsterdam/maarten/methyltransferases

From 2012.igem.org

(Difference between revisions)
Line 1: Line 1:
-
<!DOCTYPE html>
+
'{"employees":[' +
-
<html>
+
-
<body>
+
-
<h2>Create Object from JSON String</h2>
+
-
<p>
+
-
First Name: <span id="fname"></span><br />
+
-
Last Name: <span id="lname"></span><br />
+
-
</p>
+
-
<script type="text/javascript">
+
-
var txt = '{"employees":[' +
+
'{"firstName":"John","lastName":"Doe" },' +
'{"firstName":"John","lastName":"Doe" },' +
'{"firstName":"Anna","lastName":"Smith" },' +
'{"firstName":"Anna","lastName":"Smith" },' +
'{"firstName":"Peter","lastName":"Jones" }]}';
'{"firstName":"Peter","lastName":"Jones" }]}';
-
 
-
var obj = eval ("(" + txt + ")");
 
-
 
-
document.getElementById("fname").innerHTML=obj.employees[1].firstName
 
-
document.getElementById("lname").innerHTML=obj.employees[1].lastName
 
-
</script>
 
-
</body>
 
-
</html>
 

Revision as of 22:00, 1 August 2012

'{"employees":[' + '{"firstName":"John","lastName":"Doe" },' + '{"firstName":"Anna","lastName":"Smith" },' + '{"firstName":"Peter","lastName":"Jones" }]}';