Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9. <input type="text" id="txt" />
  10. <br/>
  11. <input type="button" id="btn" onclick="processString()" value ="process string"/>
  12. <br/>
  13. <textarea id="textarea" rows="4" columns="30"></textarea>
  14. <script id="jsbin-javascript">
  15. function processString (){
  16. document.getElementById('textarea').value="";
  17. var string = document.getElementById('txt').value;
  18. var result= string.match(/\d+/g);
  19. if (result!=null)
  20. {
  21. for(var i=0; i<result.length;i++)
  22. {
  23.  
  24. document.getElementById('textarea').value+=result[i]+"\r\n";
  25. }
  26. }
  27. }
  28. </script>
  29.  
  30.  
  31.  
  32. <script id="jsbin-source-javascript" type="text/javascript">function processString (){
  33. document.getElementById('textarea').value="";
  34. var string = document.getElementById('txt').value;
  35. var result= string.match(/\d+/g);
  36. if (result!=null)
  37. {
  38. for(var i=0; i<result.length;i++)
  39. {
  40.  
  41. document.getElementById('textarea').value+=result[i]+"\r\n";
  42. }
  43. }
  44. }</script></body>
  45. </html>
Add Comment
Please, Sign In to add comment