Estoy intentando hacer una URL con variable.
El objetivo es hacer que una persona escriba un número en un formulario [234893]
y al tocar el botón sea dirigido a "http://ejemplo.com/"
+ "234893"
y a esto sumarle el signo "#"
al finalizar para que el enlace termine siendo "http://ejemplo.com/234893#"
.
De momento, he conseguido las 2 primeras cosas. Me hace falta que añada el "#"
al final del enlace.
<!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>
var miUrl = "http://ejemplo.com/" + document.getElementById('txtNombre').value + "#";