kompay
09-05-2008, 01:57 PM
Hi I am trying to split the string from a text input to search a database. I will like my visitors to type a string of words on a single field and from there search all the fields of the database.
This is what I have so far...
This is the form page
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript" language="javascript" src="buscarsplit.js" >
</script>
<meta name="Microsoft Border" content="t, default">
</head>
<body >
<a href="#" onclick="splitbuscar2('1 2 3 4 5 6 7 8 9')">go</a>
<form name="la_forma" onsubmit="splitbuscar2(window.document.la_forma.box.value);return alert('por fin!!!')" method="POST" action="splitgood3.htm">
<input type="text" name="box">
<input type="hidden" name="box0" value=voy>
<input type="submit" name="su">
</form>
</body></html>
this is the function saved on a .js file
function splitbuscar2(fromm)
{
var box0;var box1;var box2;var box3;var box4;var box5;var box6;var box7;var box8;var box9;var box10;
var lista_campos =
new Array("box0","box1","box2","box3","box4","box5","box6","box7","box8","box9","box10");
alert(lista_campos);
alert(fromm);
var num_ele = 0;
var array_buscar = fromm.split(" ");
num_ele = array_buscar.length;
for (var count = 0; count < num_ele; count++)
{alert(" poss:" + array_buscar[count]);
alert("counter" + count);
window.document.write(array_buscar[count]);
lista_campos[count] = array_buscar[count];
window.document.write("b " + lista_campos);
alert("box:" + lista_campos[count]);
var voy = lista_campos[2];
}
return voy;
}
Here the script ends...
Please disregard all the alerts and writings. Just used for tracking values.
Thanks.
This is what I have so far...
This is the form page
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript" language="javascript" src="buscarsplit.js" >
</script>
<meta name="Microsoft Border" content="t, default">
</head>
<body >
<a href="#" onclick="splitbuscar2('1 2 3 4 5 6 7 8 9')">go</a>
<form name="la_forma" onsubmit="splitbuscar2(window.document.la_forma.box.value);return alert('por fin!!!')" method="POST" action="splitgood3.htm">
<input type="text" name="box">
<input type="hidden" name="box0" value=voy>
<input type="submit" name="su">
</form>
</body></html>
this is the function saved on a .js file
function splitbuscar2(fromm)
{
var box0;var box1;var box2;var box3;var box4;var box5;var box6;var box7;var box8;var box9;var box10;
var lista_campos =
new Array("box0","box1","box2","box3","box4","box5","box6","box7","box8","box9","box10");
alert(lista_campos);
alert(fromm);
var num_ele = 0;
var array_buscar = fromm.split(" ");
num_ele = array_buscar.length;
for (var count = 0; count < num_ele; count++)
{alert(" poss:" + array_buscar[count]);
alert("counter" + count);
window.document.write(array_buscar[count]);
lista_campos[count] = array_buscar[count];
window.document.write("b " + lista_campos);
alert("box:" + lista_campos[count]);
var voy = lista_campos[2];
}
return voy;
}
Here the script ends...
Please disregard all the alerts and writings. Just used for tracking values.
Thanks.