anahorn

Selenium WebDriver Ruby: Part 9 (JavaScript, Popups) 1

Jun 4th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.58 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function enter_name()
  5. {
  6. var name=prompt("Please enter your name","Artem");
  7. if (name!=null && name!="")
  8.  {
  9.  document.write("Hello " + name + "! How are you today?");
  10.   window.stop();
  11.   }
  12. }
  13. function enter_age()
  14. {
  15. var age=prompt("Please enter your age","27");
  16. if (age!=null && age!="")
  17.  {
  18.  document.write("You are " + age + " years old.");
  19.   window.stop();
  20.   }
  21. }
  22. </script>
  23. </head>
  24. <body>
  25.  
  26. <input onclick="enter_name()" type="button" value="Name" />
  27. <input onclick="enter_age()" type="button" value="Age" />
  28.  
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment