Error running Javascript in IE 6
I have designed the asp page in IE 7 on Windows XP platform the is problem is that i am unable to run the page on client's PC.At client's place there is IE 6. It is giving javacript error 'Undefined' when submit button is clicked. Please tell me how should i tackle this problem. Following is the code of the page.
<% @ Language=VBScript%>
<%
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString
Set rsnew_appts = Server.CreateObject("ADODB.Recordset")
Set rsEmp_salary = Server.CreateObject("ADODB.Recordset")
Set rsTYPE = Server.CreateObject("ADODB.Recordset")
Set rsDIV = Server.CreateObject("ADODB.Recordset")
Set rsDESG = Server.CreateObject("ADODB.Recordset")
Set rsYear = Server.CreateObject("ADODB.Recordset")
session("module")=request.querystring("module")
session("prv")=request.querystring("prv")
etype=request.form("sel_Type")
if etype="" then
etype=request.form("emp_type")
end if
div=request.form("sel_Division")
if div="" then
div=request.form("DIVISION")
end if
edesg=request.form("sel_Desg")
if edesg="" then
edesg=request.form("DESG")
end if
eyear=request.form("sel_year")
if eyear="" or eyear="select" then
eyear=request.form("yr")
end if
sqlTYPE="select distinct type from dtype"
rsTYPE.Open sqlTYPE, Conn, adOpenStatic, adLockReadOnly, adCmdText
%>
<html>
<head>
<SCRIPT type="text/javascript" language="JavaScript">
function submitform()
{
document.form1.submit();
}
function ApproveEmployee()
{
var strcondition;
strcondition=ListEmp(document.form2.chkEmp);
if (strcondition!="")
{
var r=confirm("Are you sure you want to approve increment?");
if (r==true)
{
document.form2.strcond_string.value=strcondition;
document.form2.submit();
}
}
}
function ListEmp(field)
{
try{
var strcriteria;
strcriteria="";
for (i=0; i < field.length;i++)
{
if (field[i].checked==true)
{
strcriteria=strcriteria + " (prmn_id=" + document.form2.empid[i].value + " and emp_intdt='" + document.form2.emp_incr_dt[i].value + "') OR";
}
if (i==field.length-1)
{
strcriteria=Mid(strcriteria,0,String(strcriteria). length-3);
if (strcriteria=="")
{
alert("No employee is selected for approval");
strcriteria="";
}
}
}
if (field.length==undefined)
{
if (document.form2.chkEmp.checked==true)
{
strcriteria=" (prmn_id=" + document.form2.empid.value + " and emp_intdt='" + document.form2.emp_incr_dt.value + "') ";
}
else
{
strcriteria="";
}
}
return strcriteria;
}
catch(e){
alert("Error occured in script.\nError Name:" + e.name + "\nError message:" + e.message);
return "";
}
}
function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
if (start < 0 || len < 0) return "";
var iEnd, iLen = String(str).length;
if (start + len > iLen)
iEnd = iLen;
else
iEnd = start + len;
return String(str).substring(start,iEnd);
}
</script>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style type="text/css">
.stylebr
{
border-spacing:inherit;
border:thin black inset;
border-color:gray;
border-width:1px;
}
.style15 {
border-style: solid;
border-width: 1px;
border-collapse: collapse;
}
.style18 {
border:1px inset gray;
font-family: Verdana;
font-size: 9pt;
background-color: #DCDADC;
}
.style19 {
border-style: solid;
border-width: 1px;
border-collapse: collapse;
background-color: #DCDADC;
}
.style21 {
font-family: Verdana;
}
.style22 {
font-size: xx-small;
}
.style23 {
border:1px inset gray;
font-family: Verdana;
font-size: 8pt;
text-align: center;
font-weight: bold;
color: #400080;
}
.style27 {
border:1px inset gray;
font-family: Verdana;
font-size: 7pt;
color: #400080;
}
.style28 {
border:1px inset gray;
font-family: Verdana;
font-size: 8pt;
font-weight: bold;
color: #400080;
}
.style29 {
border:1px inset gray;
font-family: Verdana;
font-size: 7pt;
color: #400080;
text-align: center;
}
.style30 {
margin-bottom: 0px;
}
.style31 {
border-style: solid;
border-width: 1px;
border-collapse: collapse;
text-align: center;
color: #400080;
}
.style32 {
color: #400080;
}
.style33 {
font-size: xx-small;
color: #400080;
}
.style34 {
color: #4E009B;
}
</style>
<title>Increment Approval</title>
</head>
<body style="background-color: #EBE9EB">
<form name="form1" action="increment_approval.asp?module=<%=session(" module")%>&prv=<%=session("prv")%>" method="post" style="height: 54px" class="style30">
<table class="style18" height="30" style="border-style: solid">
<tr>
<td class="style31" valign="bottom" colspan="4"><strong>INCREMENT
APPROVAL</strong></td>
</tr>
<tr>
<td class="style15" valign="bottom"><span class="style33">Select Type:.
</span><span class="style21"><span class="style22">
<span class="style32">
<select name="sel_Type" style="width: 105px" onchange="javascript:submitform();">
<option selected>Select</option>
<%if session("module")="HR" and session("prv")<5 then
if etype="Field Force" then
ss="selected"
else
ss=""
end if
%>
<option <%=ss%> value="Field Force"><%Response.Write "Field Force"%>
<%else
Do while not rsTYPE.eof
if etype="select" or etype="" then
if etype=rsTYPE("type") then
ss="selected"
else
ss=""
end if
else
if etype=rsTYPE("type") then
ss="selected"
else
ss=""
end if
end if
%>
<option <%=ss%> value="<%=rsTYPE("type")%>">
<%Response.Write(rsTYPE("type"))%>
<%
rsTYPE.Movenext
Loop
rsTYPE.close
end if
%>
</select></span></span></span></td>
<%
sqlDIV="select distinct dept from dtype where type='" & etype & "'"
rsDIV.Open sqlDIV, Conn, adOpenStatic, adLockReadOnly, adCmdText
%>
<td class="style15" valign="bottom"><span class="style33">Select
Division:.
</span><span class="style21"><span class="style22">
<span class="style32">
<select name="sel_Division" onchange="javascript:submitform();" style="width: 243px; height: 13px;">
<option>Select</option>
<%
Do while rsDiv.eof=false
if div="select" or div="" then
if div=rsDiv("dept") then
ss="selected"
else
ss=""
end if
else
if div=rsDiv("dept") then
ss="selected"
else
ss=""
end if
end if
%>
<option <%=ss%> value="<%=rsDIV("dept")%>">
<%Response.Write(rsDIV("dept"))%>
<%
rsDiv.movenext
loop
%>
</select></span></span></span></td>
<%
sqlDesg="select distinct dep_desg from dtype where type='" & etype & "' and dept='" & div & "'"
rsDesg.Open sqlDesg, Conn, adOpenStatic, adLockReadOnly, adCmdText
%>
<td class="style15" valign="bottom" style="width: 143px">
<span class="style33">Select Desg:.</span><span class="style21"><span class="style22"><span class="style34"><span class="style32"><select name="sel_Desg" style="width: 109px; height: 5px" onchange="javascript:submitform();">
<option selected>Select</option>
<%
Do while rsDESG.eof=false
if edesg="select" or edesg="" then
if edesg=rsDESG("dep_desg") then
ss="selected"
else
ss=""
end if
else
if edesg=rsDESG("dep_desg") then
ss="selected"
else
ss=""
end if
end if
%>
<option <%=ss%> value="<%=rsDESG("dep_desg")%>">
<%Response.Write(rsDESG("dep_desg"))%>
<%
rsDESG.movenext
loop
%>
</select></span></span></span></span></td>
<%
sqlYear="select distinct year(entry_date) as yr from new_appointments where emp_type='" & etype & "' and emp_division='" & div & "' and emp_desg='" & edesg & "'"
rsYear.Open sqlYear, Conn, adOpenStatic, adLockReadOnly, adCmdText
%>
<td class="style15"><span class="style33">Select Year:. </span><span class="style21"><span class="style22">
<span class="style32">
<select size="1" name="sel_year" class="style77" style="width:78px; height: 9px;" onchange="javascript:submitform();">
<option selected>Select</option>
<%
Do while not rsYear.eof
if ucase(eyear)="SELECT" then
if eyear=rsYear("yr") or eyear="" then
aa="selected"
else
aa=""
end if
aa=""
else
if cint(eyear)=rsYear("yr") then
aa="selected"
else
aa=""
end if
end if
%>
<option <%=aa%> value="<%=rsYear("yr")%>">
<%response.write rsYear("yr")%>
<%
rsYear.Movenext
Loop
rsYear.close
%></select></span></span></span><span class="style32">
<input type="hidden" name="emp_type" value="<%=etype%>">
<input type="hidden" name="DIVISION" value="<%=div%>">
<input type="hidden" name="DESG" value="<%=edesg%>">
<input type="hidden" name="yr" value="<%=eyear%>">
</span>
</td></tr>
</table>
</form>
<table width="100%" class="style19" style="border-style: solid" height="45">
<form name="form2" action="approve_incr.asp?module=<%=session("module ")%>&prv=<%=session("prv")%>" method="post" style="height: 68px">
<tr>
<td style="width: 22px; height: 30px;" class="style28">Sr No.</td>
<td style="width: 51px; height: 30px;" class="style28">Emp. Code</td>
<td style="width: 222px; height: 30px;" nowrap="nowrap" class="style28">
Emp. Name</td>
<td class="style23" style="height: 30px; width: 97px;">Division</td>
<td style="width: 200px; height: 30px;" nowrap="nowrap" class="style23">
HQ</td>
<td class="style23" style="width: 91px; height: 30px;">Incr. Date.</td>
<td class="style23" style="width: 91px; height: 30px;">Incr. Amt.</td>
<td class="style23" style="height: 30px">Aprroved</td>
</tr>
<%
if request.form("sel_type") <>"Select" and request.form("sel_Division")<>"Select" and request.form("sel_desg")<>"Select" and request.form("sel_year")<>"Select" then
i=0
j=0
With rsnew_appts
.Open "Select prmn_id,emp_name,emp_division,emp_hq,basic,fda,vda ,adv_allowance,hra,edu_all,conv_all," & _
"med_all,cash_lta,oth_pay,reinb_info,spl_all,cash, cca,da,tour_all,overnight," & _
"yr_med_all,yr_lta,appr_stat,emp_stat,emp_intd t from new_appointments where entry_flag=6 and " & _
"emp_type='" & etype & "' and emp_division='" & div & "' and emp_desg='" & edesg & "' and year(emp_intdt)=" & CInt(eyear) & " Order by appr_stat,prmn_id,emp_intdt", conn, adOpenStatic, adLockReadOnly
If .EOF = False Then
Do While .EOF = False
If lcase(.fields("emp_stat"))="false" then ''fasle - 0
sqlEmp_Salary="Select prmn_id,basic,fda,vda,adv_allowance,hra,edu_all,co nv_all,med_all,cash_lta,oth_pay,reinb_info,spl_all ,cash,cca,yr_med_all,yr_lta from emp_salary where prmn_id=" & rsnew_appts.Fields("prmn_id")
ElseIf lcase(.fields("emp_stat"))="true" then ''true - 1
sqlEmp_Salary="Select Top 1 prmn_id,incr_date,basic,fda,vda,adv_allowance,hra, edu_all,conv_all,med_all,cash_lta,oth_pay,reinb_in fo,spl_all,cash,cca,yr_med_all,yr_lta from emp_sal_history where prmn_id=" & rsnew_appts.Fields("prmn_id") & " and incr_date<>'"& rsnew_appts.Fields("emp_intdt") &"' order by incr_date desc"
End If
With rsEmp_salary
If .State = adStateOpen Then .Close
.Open sqlEmp_Salary, conn, adOpenStatic, adLockReadOnly
If .EOF = False Then
increment_amt = (rsnew_appts("basic") - rsEmp_salary("basic")) + _
(rsnew_appts("fda") - rsEmp_salary("fda")) + _
(rsnew_appts("vda") - rsEmp_salary("vda")) + _
(rsnew_appts("adv_allowance") - rsEmp_salary("adv_allowance")) + _
(rsnew_appts("hra") - rsEmp_salary("hra")) + _
(rsnew_appts("edu_all") - rsEmp_salary("edu_all")) + _
(rsnew_appts("conv_all") - rsEmp_salary("conv_all")) + _
(rsnew_appts("oth_pay") - rsEmp_salary("oth_pay")) + _
(rsnew_appts("reinb_info") - rsEmp_salary("reinb_info")) + _
(rsnew_appts("spl_all") - rsEmp_salary("spl_all")) + _
(rsnew_appts("cash") - rsEmp_salary("cash")) + _
(rsnew_appts("cca") - rsEmp_salary("cca"))
If rsnew_appts("med_all") = 0 Then
increment_amt = increment_amt + ((rsnew_appts("yr_med_all") / 12) - (rsEmp_salary("yr_med_all") / 12))
Else
increment_amt = increment_amt + (rsnew_appts("med_all") - rsEmp_salary("med_all"))
End If
If rsnew_appts("cash_lta") = 0 Then
increment_amt = increment_amt + ((rsnew_appts("yr_lta") / 12) - (rsEmp_salary("yr_lta") / 12))
Else
increment_amt = increment_amt + (rsnew_appts("cash_lta") - rsEmp_salary("cash_lta"))
End If
Else
increment_amt = 0
End If
End With
i=i+1
if rsnew_appts.Fields("appr_stat")=2 then
ss="#DEDBDE"
else
ss="white"
end if
%>
<tr id="tblrow">
<td style="width: 22px; height: 5px" class="style29" bgcolor="<%=ss%>"><%=i%></td>
<td style="width: 51px; height: 5px" class="style29" bgcolor="<%=ss%>"><%=rsnew_appts.Fields("prmn_id") %></td>
<td style="width: 222px; height: 5px" nowrap="nowrap" class="style27" bgcolor="<%=ss%>"><%=rsnew_appts.Fields("emp_name" )%></td>
<td class="style27" style="width: 97px; height: 5px" bgcolor="<%=ss%>"><%=rsnew_appts.Fields("emp_divis ion")%></td>
<td style="width: 200px; height: 5px" nowrap="nowrap" class="style27" bgcolor="<%=ss%>"><%=rsnew_appts.Fields("emp_hq")% ></td>
<td class="style29" style="width: 91px; height: 5px" bgcolor="<%=ss%>"><%=rsnew_appts.Fields("emp_intdt ")%></td>
<td class="style29" style="width: 91px; height: 5px" bgcolor="<%=ss%>"><%=increment_amt%></td>
<td class="style29" bgcolor="<%=ss%>" style="height: 5px">
<%if rsnew_appts.Fields("appr_stat")=2 then%>
<input type="checkbox" name="chkdisabled" disabled checked>
<%else%>
<input type="checkbox" name="chkEmp" id=<%=j%>>
<input type="hidden" name="empid" id=<%=j%> value=<%=rsnew_appts.Fields("prmn_id")%>>
<input type="hidden" name="emp_incr_dt" id=<%=j%> value=<%=rsnew_appts.Fields("emp_intdt")%>>
<%j=j+1
end if%> </td></tr>
<%
.MoveNext
Loop
End If
End With
end if%>
<tr><td class="style29" bgcolor="<%=ss%>" colspan="9">
<input name="update" type="button" value="submit" onclick="javascript:ApproveEmployee();">
<input name="strcond_string" type="hidden">
</td></tr>
</form>
</table>
</body>
<%conn.close%>
</html>
987654321
__________________
987654321
|