SHOW:
|
|
- or go back to the newest paste.
1 | <!DOCTYPE> | |
2 | <html> | |
3 | <head> | |
4 | <meta charset="utf-8" /> | |
5 | ||
6 | <script type="text/javascript" src="taffy.js"> | |
7 | </script> | |
8 | ||
9 | <!--<script type="text/javascript" language="javascript" src="database_temp.js"> | |
10 | </script>--> | |
11 | ||
12 | <script type="text/javascript" language="javascript"> | |
13 | ||
14 | var db = TAFFY([{record:1,text:"example"}]) | |
15 | ||
16 | function add_scope_section() | |
17 | { | |
18 | ||
19 | var num_sections = db().max("record"); | |
20 | alert(num_sections); | |
21 | var section = document.getElementById("new_section").value; | |
22 | alert(section); | |
23 | var scope = document.getElementById("new_scope").value; | |
24 | alert(scope); | |
25 | ||
26 | num_sections = num_sections + 1; | |
27 | num_sections = Number(num_sections); | |
28 | alert(num_sections); | |
29 | db.insert({record:num_sections, text:"example2"}); | |
30 | alert(db().stringify()); | |
31 | ||
32 | }; | |
33 | ||
34 | </script> | |
35 | </head> | |
36 | ||
37 | <body> | |
38 | <h2>Add Something New</h2> | |
39 | <!--Add new section and scope to the database--> | |
40 | <h3>New Section and Scope</h3> | |
41 | <form name="form1" onsubmit="add_scope_section()" enctype="multipart/form-data"> | |
42 | <label for="new_section">New Section: </label><input type="text" name="new_section" id="new_section" \> | |
43 | <br /> | |
44 | <label for="new_scope">New Scope: </label><input type="text" name="new_scope" id="new_scope" \> | |
45 | <br /> | |
46 | <br /> | |
47 | <input type="submit" value="Submit Form 1" /> | |
48 | </form> | |
49 | ||
50 | </body> | |
51 | </html> |