Javascript simulate keyboard [duplicate]

0

Hi, I have the following case, an external page opens inside my iframe, I need javascript to simulate the "TAB" key until it reaches the login field. So much so why my problem is to find a way to make it simulate this "TAB" without any other event being dispatched, just loading the page.

follow example, but not

<?php

echo '<script type="text/javascript" src="js/jquery.js"> </script>';

?>

<html>


<iframe src="http://alelo.com.br/consulta-saldo-extrato-alelo.html"style="width:100%; height:100%">

<script>

alert('.-.');

</script>

</html>
    
asked by anonymous 05.06.2015 / 16:55

1 answer

0

Maybe that's what you want, just use the "autofocus" attribute in the "input."

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>focus demo</title>
<style>
    span {
        display: none;
    }
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body><p><inputautofocustype="text"> <span>Login</span></p>
<p><input type="password"> <span>Senha</span></p>

<script>
    $( "input" ).focus(function() {
        $( this ).next( "span" ).css( "display", "inline" ).fadeOut( 1000 );
    });
</script>

Automatically loading the page focus is given to the first page input.

    
05.06.2015 / 18:32