input.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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="Standard input">
  33. </textarea>
  34. <br><br>
  35. <!-- Accepting command-line agruments -->
  36. <input type="text" name="args" placeholder="Command-line arguments">
  37. <br><br>
  38. <!-- Submit button goes here -->
  39. <button type="submit">Run</button>
  40. </form>
  41. <br>
  42. <!-- Provide a link to text input option -->
  43. <button href="textinput.php" target="output">Submit a text file</button>
  44. <script>
  45. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  46. lineNumbers: true,
  47. matchBrackets: true,
  48. lineWrapping: true,
  49. tabMode: "indent",
  50. indentUnit: 4,
  51. mode: "text/x-c++src"
  52. });
  53. </script>
  54. </body>
  55. </html>