To open in the same window the command would be:
<form>
<input name="url" type="text" id="cpf">
<input type="button" id="btn" value="Acessar" onClick="javascript: window.location.href = 'http://site.com.br/' + document.getElementById('cpf').value + '-2/';"
The window.open
is used to create a new window, the window.location.href
will indicate to the browser that the new address must be the parameter being informed.
May also be used window.location.assign(url)
, as listed below.
References:
open window. : https://developer.mozilla.org/pt-PT/docs/Web/API/Window/open
window.Location : https://developer.mozilla.org/en-US/docs/Web/API/Window/location
When using
window.open
you are explicitly saying to open a new window. Search how to do to redirect the user.– Woss