Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <body>
  2. <div style="margin:0;">
  3. <iframe id="hk_iframe" src="Ng-Click-1.html" frameborder="0" width="100%" Height="768" scrolling="no">do not support iframe</iframe>
  4. </div>
  5.  
  6. <script type="text/javascript">
  7. jQuery.fn.simulateKeyPress = function(character) {
  8. jQuery(this).trigger({ type: 'keypress', which: character.charCodeAt(0) });
  9. };
  10.  
  11. $(function() {
  12. $('#hk_iframe').load(function(){
  13. var $iframe = $(this),
  14. $contents = $iframe.contents();
  15. window.setTimeout(function(){
  16. $contents.find('#textbox').keypress( function(e) {
  17. //alert( String.fromCharCode( e.which ) );
  18. console.log(e);
  19. });
  20. $contents.find('#textbox').simulateKeyPress('x');
  21. $contents.find('#textbox').val('user1');
  22.  
  23. $contents.find('#password').keypress( function(e) {
  24. //alert( String.fromCharCode( e.which ) );
  25. console.log(e);
  26. });
  27. $contents.find('#password').simulateKeyPress('x');
  28. $contents.find('#password').val('user123456');
  29.  
  30. $contents.find('#login').click();
  31. }, 1000);
  32. });
  33. });
  34. </script>
  35. </body>
  36.  
  37. <body ng-app="">
  38. <form name="form">
  39. <div ng-hide="isShow">
  40. User Name <input type="text" required ng-model="userName" id = "textbox"/><br /><br />
  41. Password <input type="password" required ng-model="password" id="password"/><br /><br />
  42. <input type="button" ng-disabled="form.$invalid" ng-click="isShow = true" value="Login" id="login"/>
  43. </div>
  44. <div ng-show="isShow">
  45. Successfully Login.<br />
  46. <input type="button" ng-click="isShow = false;password='';userName=''" value="Logout" />
  47. </div>
  48. </form>
  49. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement