Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <div style="margin:0;">
- <iframe id="hk_iframe" src="Ng-Click-1.html" frameborder="0" width="100%" Height="768" scrolling="no">do not support iframe</iframe>
- </div>
- <script type="text/javascript">
- jQuery.fn.simulateKeyPress = function(character) {
- jQuery(this).trigger({ type: 'keypress', which: character.charCodeAt(0) });
- };
- $(function() {
- $('#hk_iframe').load(function(){
- var $iframe = $(this),
- $contents = $iframe.contents();
- window.setTimeout(function(){
- $contents.find('#textbox').keypress( function(e) {
- //alert( String.fromCharCode( e.which ) );
- console.log(e);
- });
- $contents.find('#textbox').simulateKeyPress('x');
- $contents.find('#textbox').val('user1');
- $contents.find('#password').keypress( function(e) {
- //alert( String.fromCharCode( e.which ) );
- console.log(e);
- });
- $contents.find('#password').simulateKeyPress('x');
- $contents.find('#password').val('user123456');
- $contents.find('#login').click();
- }, 1000);
- });
- });
- </script>
- </body>
- <body ng-app="">
- <form name="form">
- <div ng-hide="isShow">
- User Name <input type="text" required ng-model="userName" id = "textbox"/><br /><br />
- Password <input type="password" required ng-model="password" id="password"/><br /><br />
- <input type="button" ng-disabled="form.$invalid" ng-click="isShow = true" value="Login" id="login"/>
- </div>
- <div ng-show="isShow">
- Successfully Login.<br />
- <input type="button" ng-click="isShow = false;password='';userName=''" value="Logout" />
- </div>
- </form>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement