|
I have a form called 'fexp' and two hidden fields called 'multileg' and 'submitcounter', and they both have values of 'true' to start with. I have a Javascript function as per below:
function submitvalues()
{
if ((document.fexp.multileg.value == true)&&(document.fexp.submitcounter.value == true))
{
document.fexp.submit();
document.fexp.multileg.value == false;
document.fexp.submitcounter.value == false;
}
}
I call it in the <body> tag:
<body bgcolor="#f5f5f5" leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 onload="setframe();document.fexp.depapt.focus();return submitvalues();">
But i keep get this error:
document.fexp.multileg.value is null or not a object.
However, it is DEFINATELY there:
<input type="hidden" name="multileg" value="<%=multileg%>">
<input type="hidden" name="submitcounter" value="<%=submitcounter%>">
|
|
|
see the following code
<html>
<script>
function comeon()
{
alert(document.forms[0].value1.value);
if ((document.forms[0].value1.value.match(true))&&(document.forms[0].value2.value.match(true)))
{
alert("value is True");
}
else
{
alert("Value is not True");
}
}
</script>
<body onload="comeon()">
<form>
<input type=hidden value="true" name="value1">
<input type=hidden value="true" name="value2">
<input type="button" value="button" name="Submit" onclick="comeon()">
</form>
</body>
</html>
|
|
if u not satisfied with this code send u'r code fully
then only i can identify error .
while comparing strings in Javascript don't use == operator use match function
thanks.
|
|
|
try this...
u use forms elements after the submit.... may be this cause u js bugs...
function submitvalues()
{
if ((document.fexp.multileg.value == 'true')&&(document.fexp.submitcounter.value == 'true'))
{
document.fexp.multileg.value = 'false';
document.fexp.submitcounter.value = 'false';
document.fexp.submit();
}
}
|
|
|
|
|
|
|
|