gamesbondgirl
12-02-2002, 07:36 AM
Hello !
I have to transfer form's var. to a script, and make a window.location with var.
The onclick event works on the button.
But I make an onsubmit event in the textfield, in case of "ENTER", the script is right read, I can alert some messages but the window.location doesn't work.
Could you help me ?
MY PAGE :
<script language="javascript">
function transfert()
{
var motcle = document.rech['motcle'].value;
loc = 'aff_liste.asp?valide=1&motcle='+motcle
window.location = loc;
alert('coucou');
}
</Script>
<form method="post" name="rech" onSubmit="javascript:transfert()">
<input type="text" name="motcle" >
<input type="button" value="Rechercher" onclick="javascript:transfert()">
</form>
I have to transfer form's var. to a script, and make a window.location with var.
The onclick event works on the button.
But I make an onsubmit event in the textfield, in case of "ENTER", the script is right read, I can alert some messages but the window.location doesn't work.
Could you help me ?
MY PAGE :
<script language="javascript">
function transfert()
{
var motcle = document.rech['motcle'].value;
loc = 'aff_liste.asp?valide=1&motcle='+motcle
window.location = loc;
alert('coucou');
}
</Script>
<form method="post" name="rech" onSubmit="javascript:transfert()">
<input type="text" name="motcle" >
<input type="button" value="Rechercher" onclick="javascript:transfert()">
</form>