How to pass the variable in the asp form to a javascript function "Validatedata()" while form submit?
<%
dim CountryCode,strNumber,strAddress,strCity,strState, strPostcode,
dim MyServID,CustRefNo
dim strServiceId,strCompany
%>
<SCRIPT LANGUAGE="JavaScript">
function Validatedata(){
var strurl, strCountry,strcompname,strcompnumber,strcompaddres s,strcompcity,strcompstate,strcompzipcode,servicet ype;
var emptyflag,CustRefNo ;
emptyflag = 0;
var t,serviceid;
if(emptyflag == 0 ){
strurl= "payforservices.asp?fromaction=4&MyServID="+servic eid+"&Country="+ strCountry +"&Number="+strcompnumber+"&Name="+ strcompname + "&Address="+strcompaddress+"&State="+strcompstate+ "&City="+strcompcity+"&Postcode="+strcompzipcode+" &CustRefNo="+CustRefNo;
location.href = strurl;
}
}
</SCRIPT>
<%
connectDB()
Set RS = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection=objConn
RS.Source=sql
RS.open
If not RS.eof then
if RS("servicetype") = "12" and RS("serviceid") = "14" then %>
<form method=post name="frmindex">
<table border=0 width=98% align=center cellspacing=0 cellpadding=2>
<TR class="formSectionHeader">
<TD colspan=2 align=left>Details</TD>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Service </td>
<TD width=70% class="clsMainFont" align=left><%=RS("servicedescription")%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Type</td>
<TD width=70% class="clsMainFont" align=left><%=RS("settingsdescription")%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Name</td>
<TD width=70% class="clsMainFont" align=left ><%=RS("subjectname")%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Subject #</td>
<TD width=70% class="clsMainFont" align=left><%=RS("subjectuniqueid")%>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Address</td>
<TD width=70% class="clsMainFont" align=left><%=RS("subjectaddress1")%> <%=RS(" subjectaddress2")%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>City</td>
<TD width=70% class="clsMainFont" align=left><%if subjectcity <> "" then%><%=RS("subjectcity")%><%end if%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>State</td>
<TD width=70% class="clsMainFont" align=left><%if subjectstate <> "" then%> <%=RS("subjectstate")%><%end if%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Country</td>
<TD width=70% class="clsMainFont" align=left><%=GetCountrySettings(RS("subjectcountr y"))%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Post Code</td>
<TD width=70% class="clsMainFont" align=left>
<%if subjectzip <> "" then%> <%=RS("subjectzip")%><%end if%> </TD>
</TR>
<TR class="FormSectionbody">
<td class=formLabel width=30% align=left>Customer Ref.#</td>
<TD width=70% class="clsMainFont" name="CustRefNo" value="<%=RS("customerreferencenumber")%>" align=left><%=RS("customerreferencenumber")%>  ;</TD>
</TR>
<TR class="FormSectionbody">
<TD class="formLabel" align=left> </TD>
<TD><INPUT TYPE="button" value=" Next " onclick="javascript: Validatedata();" maxlength="200" id=button1 name=button1></TD>
</TR>
<%
RS.close
set RS = Nothing
disconnectDB()
%>