Team:TU-Delft/SynBioData

From 2013.igem.org

(Difference between revisions)
Line 5: Line 5:
<html>
<html>
-
<?php
+
<script>
-
    $db = mysqli_connect('jdbc:mysql://localhost:3306/syntheticbiology','dimitra','dimitra','syntheticbiology');
+
var db = null;
-
?>
+
function html5_storage_support() {
-
<html>
+
  try {
-
     <body>
+
    return 'localStorage' in window && window['localStorage'] == null;
-
          <?php
+
  } catch (e) {
-
                $query = "SELECT * FROM 'interviews';";
+
    return false;
-
                $result = mysqli_query($db, $query);
+
  }
-
                while($row = mysqli_fetch_assoc($result)) {
+
}
-
                      // Display your datas on the page
+
//CHECK TO SEE IF THE BROWSER IS COMPATIBLE
-
                }
+
if (!html5_storage_support) {
-
          ?>
+
  alert("This Might Be a Good Time to Upgrade Your Browser or Turn On Jeavascript");
-
    </body>
+
} else {
 +
 
 +
//OPEN AND OR CREATE THE DATABASE ON THE USERS MACHINE
 +
db = openDatabase("MyContacts", "1", "My Personal Contacts", 100000);
 +
 
 +
function storeMyContact(id) {
 +
var fullname = document.getElementById('fullname').innerHTML;
 +
var phone = document.getElementById('phone').innerHTML;
 +
var email = document.getElementById('email').innerHTML;
 +
localStorage.setItem('mcFull',fullname);
 +
localStorage.setItem('mcPhone',phone);
 +
localStorage.setItem('mcEmail',email);
 +
}
 +
  //GET STORED VALUES FROM KEYS TO DEFINE JAVASCRIPT VALUES OR DEFINE IF THEY DO NOT EXIST
 +
  function getMyContact() {
 +
    if ( localStorage.getItem('mcFull')) {
 +
      var fullname = localStorage.getItem('mcFull');
 +
      var phone = localStorage.getItem('mcPhone');
 +
      var email = localStorage.getItem('mcEmail');
 +
     }
 +
    else {
 +
      var fullname = 'Click And Enter A Name';
 +
      var phone = 'Click And Enter A Phone Number';
 +
      var email = 'Click And Enter An Email Address';
 +
    }
 +
    document.getElementById('fullname').innerHTML = fullname;
 +
    document.getElementById('phone').innerHTML = phone;
 +
    document.getElementById('email').innerHTML = email;
 +
  }
 +
 
 +
  function clearLocal() {
 +
    clear: localStorage.clear();
 +
    return false;
 +
  }
 +
}
 +
</script>
 +
<div id="myContacts">
 +
  <div>N: <span id="fullname" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
 +
  <div>P: <span id="phone" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
 +
  <div>E: <span id="email" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
 +
  <div><a onclick="clearLocal(); getMyContact();" href="javascript:void(0);">Clear All Of My Data</a></div>
 +
</div>
 +
<script>
 +
  getMyContact();
 +
</script>
</html>
</html>

Revision as of 08:54, 2 September 2013