Create link based on a user input

Asked

Viewed 62 times

0

I’m trying to create a page - which can be in any language, but needs to be stored in a single file - for a user to enter their login and from there, a link to proceed to a site.

This site gets the user on your link, so: https://site.com.br/usuario=LOGIN&enterprise

What I was able to do was a static redirect link:

    <script>
    var login = "loginname";
    </script>

    <a href="#" onclick="window.open('site.com.br/usuario=' + login + '&empresa')" target"_blank">Go to site</a>

I want to make a text box with a button on the side so that when clicking, the user is redirected.

1 answer

0


Something very simple and in javascript:

<script language="javascript">
function Login(){
var username=document.login.username.value;

if (username!="") { 
window.location="http://site.com.br?usuario="+username;
}

}

</script>

<form name=login>

<input type="text" name="username" size="9">
<input type="button" value="Entrar" onClick="Login()">

</form>
  • Man, that was it! Thank you so much! It worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.