input.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!-- Code by Sunit Kumar Nandi -->
  2. <!DOCTYPE html>
  3. <head>
  4. <!-- Inserting CodeMirror text editor -->
  5. <!-- Credit for the idea goes to Aditya Rajan -->
  6. <meta charset="utf-8" script=>
  7. <link rel="stylesheet" type="text/css" href="style.css">
  8. <link rel="stylesheet" href="assets/codemirror.css">
  9. <script src="assets/codemirror.js"></script>
  10. <script src="assets/matchbrackets.js"></script>
  11. <script src="assets/clike.js"></script>
  12. <style>.CodeMirror {border: 1px solid #ccc; width:500px; }</style>
  13. </head>
  14. <body>
  15. <!-- Specifying how the form data should be processed -->
  16. <form name="form1" method="post" target="output" action="output.php?saving=1">
  17. Write your program here:
  18. <br>
  19. <!-- Accepting program code -->
  20. <textarea id="code" name="data" cols="100" rows="10">
  21. #include<iostream>
  22. using namespace std;
  23. int main()
  24. {
  25. cout << "Hello world!";
  26. return 0;
  27. }
  28. </textarea>
  29. <br><br>
  30. <!-- Accepting standard input -->
  31. Standard input:<br>
  32. <textarea name="stdin" cols="60" rows="10" placeholder="Type in keyboard inputs here">
  33. </textarea>
  34. <br><br>
  35. <!-- Accepting command-line agruments -->
  36. Command-line arguments:<br>
  37. <input type="text" name="args" placeholder="Type in parameters to pass to program">
  38. <br><br>
  39. <!-- Submit button goes here -->
  40. <button type="submit">Run</button>
  41. </form>
  42. <br>
  43. <!-- Provide a link to text input option -->
  44. <button href="textinput.php" target="output">Submit a text file</button>
  45. <script>
  46. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  47. lineNumbers: true,
  48. matchBrackets: true,
  49. lineWrapping: true,
  50. tabMode: "indent",
  51. indentUnit: 4,
  52. mode: "text/x-c++src"
  53. });
  54. </script>
  55. </body>
  56. </html>