I am trying to make a url with variable.
The objective is to make a person write a number in a form [234893]
and when they touch the button they are directed to "http://ejemplo.com/"
+ "234893"
and to this add the sign "#"
at the end so that the link ends up being "http://ejemplo.com/234893#"
.
So far, I have achieved the first 2 things. I need to add the "#"
at the end of the link.
<!DOCTYPE html>
<html>
<head>
<script>
function setNombre() {
var miUrl = "http://ejemplo.com/" + document.getElementById("txtNombre").value;
window.open(miUrl);
}
</script>
</head>
<body>
Número de Tarjeta: <input id="txtNombre" type="text" name="fname" /><br />
<button id="btnEnv" type="button" onclick="setNombre()">Enviar</button>
</body>
</html>
In this case if you enter "234893" the url will open:
https://example.com/234893#