Hello !
I have been working with Javascript for long now, and I have a problem I can't solve (driving me insane).
I wrote a function to check the fields of a form befor submitting it.It goes like this :
function verif() {
var b1 = (formRech.dCodeSCS.value==""
;
var b2 = (formRech.dNTitulaire.value==""
;
if ((not(b1)) and (not(b2))
{alert("You can't fill both options"
;}
else {if (b1 and b2)
{alert("Please fill in a field"
;}
else {if (b1) {formRech.SFRou7.value="7";formRech.submit();}
else {document.formRech.SFRou7.value="SFR";formRech.submit();}
}
}
}
Hope it can be understood !
And then I call the function like this:
<a href="#"><img src="images/valider.gif" onClick="verif();" width="78" height="26" border="0" alt="Lancer la recherche"></a>
When I click on the image, ie gives me an error : Object expected (in French : objet attendu), and I just CAN'T understand why it won't work !
Please help me!!!
Gaelle, from France.
I have been working with Javascript for long now, and I have a problem I can't solve (driving me insane).
I wrote a function to check the fields of a form befor submitting it.It goes like this :
function verif() {
var b1 = (formRech.dCodeSCS.value==""
var b2 = (formRech.dNTitulaire.value==""
if ((not(b1)) and (not(b2))
{alert("You can't fill both options"
else {if (b1 and b2)
{alert("Please fill in a field"
else {if (b1) {formRech.SFRou7.value="7";formRech.submit();}
else {document.formRech.SFRou7.value="SFR";formRech.submit();}
}
}
}
Hope it can be understood !
And then I call the function like this:
<a href="#"><img src="images/valider.gif" onClick="verif();" width="78" height="26" border="0" alt="Lancer la recherche"></a>
When I click on the image, ie gives me an error : Object expected (in French : objet attendu), and I just CAN'T understand why it won't work !
Please help me!!!
Gaelle, from France.