I have this code.
when I choose CODE option, run option1.php, and
when I choose NAME option, run option2.php.
But I need to change option1.php to code.php and option2.php to name.php.
Can you help me?
<html>
<head>
<script language="javascript">
var redireccionar = function(valor) {
// get checked first...
var selected, len = valor.length; //
while(len--) {
if (valor[len].checked)
selected = valor[len].value;
}
document.getElementById("formulario").setAttribute("action", "./OPTION"+selected+".PHP");
document.getElementById("formulario").submit();
};
window.onload = function() {
document.getElementById("button").onclick = function() {
redireccionar(document.formulario.opciones);
};
document.getElementById("texto").onmouseover = function() {
this.focus();
};
};
</script>
</head>
<body>
<form name="formulario" id="formulario" method="post">
<input type="radio" name="opciones" value="1" checked="checked">CODE:
<input type="radio" name="opciones" value="2">NAME:
<input type="text" name="Texto" id="texto">
<input type="button" name="Boton" id="button" value="Search">
</form>
</body>
</html>


Reply With Quote

Bookmarks