Hi, I am trying to use a form with two submit buttons, textarea and a dropdown list, empl in the function faction(target) is empty ???????????
<script language="JavaScript">
function gotoFunction() {
parameter = myform.employee.options[myform.employee.selectedIndex].value
alert("from gotoFunction() : " + parameter);
return parameter;
}
function faction(target)
{
var empl=gotoFunction();
if(target == 0) document.myform.action='insertOutdate.php?employee=' + empl;
if(target == 1) document.myform.action="insertIndate.php?employee=" + empl;
}
</script>
</head>
<body>
<form name="myform" action="" >
<FONT FACE="Verdana,Helvatica,Arial" SIZE="2">
<TABLE BORDER=2 width=380 CELLPADDING=7 BGCOLOR="#eeeeff" >
<TR>
<TD> <br>
<B>Select : </B>
<SELECT NAME="employee" onChange="gotoFunction()" onBlur="return options[0].selected = true">
<OPTION VALUE=" "> Employees >> </OPTION>
<OPTION VALUE="majid"> MAJID </OPTION>
<OPTION VALUE="john"> JOHN </OPTION>
<OPTION VALUE="aicha"> AICHA </OPTION>
</SELECT>
<P><B>Comments</B>
<BR><TEXTAREA WRAP=VIRTUAL NAME="comments" COLS=40 ROWS=5>WRITE COMMENT HERE.</TEXTAREA>
<BR><BR><div align="center">
<INPUT TYPE="SUBMIT" onClick="faction(0)" VALUE="CHECK OUT">
<INPUT TYPE="SUBMIT" onClick="faction(1)" VALUE="CHECK IN">
<INPUT type="button" value="Close" onClick="window.close()">
</TD>
</TR>
</TABLE></font></FORM>
Please help.
thanks