[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.0

Calling JavaScript Function file in ASP

Asked by radhakrishan1 in Active Server Pages (ASP)

Tags: javascript

I have created a common JavaScript file which will be used for all the modules. It does the date validations for me. Whenever, a date is being entered it is being validated and if invalid it will prompt user to enter the correct the date.

If I keep the Javascript function in the ASP file it work. But now I have created a common Javascript function file and when I call the function in Javascript file from ASP, it gives me errors.

Look for TextDateFrom & TextDateTo.

How can u create a common function file and call this from ASP. It gives me an error at

<input id="txDateFrom" name="txtDateFrom" size="10" maxlength="10" value=<%=Date()-22%>
                              onFocus="javascript:vDateType='3'" onKeyUp="DateFormat(this,this.value,event,false,'3')" onBlur="DateFormat(this,this.value,event,true,'3')">

My ASP modules is :
<HTML>
<HEAD>
<TITLE>Total Volumes processed by Each Site</TITLE>
<!-- #include file="adovbs.inc" -->
</HEAD>
<BODY BGCOLOR="#ffffff">
<SCRIPT language="JavaScript" src=DateValidation.js></SCRIPT>

<%
dim objConn, ObjRS, sSQL, tempdate, datefrom, depot, dateto, dat1, dat2, origdat1
dim tempdateto, tempdatefrom, dd, origdd, status, name

dateto=CDate(Request.Form("txtdateTo"))
If dateto=0 then
dateto=date()-19
datefrom=date()-22
tempdateto=dateto
tempdatefrom=datefrom
else
dateto=CDate(Request.Form("txtdateTo"))
datefrom=CDate(Request.Form("txtdateFrom"))
tempdateto=dateto
tempdatefrom=datefrom
end if

name = "All Sites"


Session.LCID = 2057

orig1=CLng((right("00" & Day(datefrom),2) & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
dat1=CLng((right("00" & Day(datefrom),2) & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
dat2=CLng((right("00" & Day(dateto),2) & "" & right("00" & Month(dateto),2) & "" & Year(dateto)))
dd=CLng(right("00" & Day(datefrom),2))
origdd=CLng(right("00" & Day(datefrom),2))

set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "provider=sqloledb;data source=JRL002465;initial catalog=lokesh;user id=sa;password=;"

set ObjRS = Server.CreateObject("ADODB.Recordset")
set ObjRS.ActiveConnection = objConn
ObjRS.CursorType = adOpenStatic
ObjRS.CursorLocation = adUseClient

sSql="select distinct del_depot_code,count(*),date_urn_scan from masteretox where del_depot_code <>'A'" &_
"and date_urn_scan>=" &_
dat1 &_
"and date_urn_scan<=" &_
dat2 &_
"and bypassed<>'B'" &_
"group by del_depot_code, date_urn_scan order by del_depot_code, date_urn_scan"


ObjRS.Open sSql

set ObjR1 = Server.CreateObject("ADODB.Recordset")
set ObjR1.ActiveConnection = objConn
ObjR1.CursorType = adOpenStatic
ObjR1.CursorLocation = adUseClient
Dim sql
sql="Select * from sites order by site_name"
ObjR1.Open sql

Dim r, count, total
'r is an index variable for the for loops, count is the number of rows of data
total = objRS.RecordCount
count = ObjRS.Fields.Count - 1
Dim arrDel(100), arrVol(100), arrComp(100), arrHorDel(100), arrHorVol(100)
Dim arrHorTotVol(100), arrHorTotDel(100), arrHorTot(100), arrHorTotComp(100)
      r = "0"                        
      for r = 0 to count
            arrDel(r) = 0
            arrVol(r)=0
            arrComp(r)=0
            arrHorDel(r)=0
            arrHorVol(r)=0
            arrHorTot(r)=0
            arrHorTotVol(r)=0
            arrHorTotDel(r)=0
            arrHorTotComp(r)=0
   next

  ' start building the table
%>

<form name="formVolumes" method="post" action="Site.asp" onSubmit="return goSubmit();">
  <table border="0" cellspacing="0" cellpadding="0" width="390" align="center">
    <tr align="middle">
            <td nowrap><IMG height=29 src="etos.gif" width=74 align=center></td>
      </tr>
    <tr><td><font size=2>
      <%Response.Write "Date From : " &datefrom%>&nbsp;&nbsp;&nbsp;&nbsp;
      <%Response.Write "Date To : " & dateto%>&nbsp;&nbsp;&nbsp;&nbsp;
      <%Response.Write "Site : " & name%>&nbsp;
    </td></tr>  
</table>
<TABLE border="2" cellspacing="0" cellpadding="1" bordercolor="#ccccff" align="Center">
<colgroup>
      <col WIDTH="60">
<tr bgcolor='#ccccff'>
<td rowspan="2" height="44"><b>DCSite</b></td>
<%
while not (tempdatefrom>tempdateto)
%>
<td  height="25" width='80'>
      <p align="center">
      <%=tempdatefrom%></td>
   <%
   tempdatefrom=tempdatefrom+1
wend
%>
<td  height="25">
      <p align="center">Total</td>
</tr>
<tr bgcolor='#ccccff'>
<%
'Initialising again
tempdateto=dateto
tempdatefrom=datefrom
   while not (tempdatefrom>tempdateto)
   Response.Write "<TD><B>" & " Volumes " & "</TD></B>"
   tempdatefrom=tempdatefrom+1
   wend
   Response.Write "<TD><B>" & " Volumes " & "</TD></B>"
   tempdatefrom=tempdatefrom+1
   Response.Write "</td></tr>"
%>
</colgroup>
<%

Status=""
while not ObjR1.EOF
Response.Write "<TR ALIGN=CENTER>"      
tempdateto=dateto
tempdatefrom=datefrom
dd=origdd
dat1=CLng((dd & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
Response.Write "<TD>" & ObjR1(0) & "</TD>"
     
while (tempdatefrom<=tempdateto)
If ObjRS.BOF = False then
       ObjRS.MoveFirst
End if
      While Not ObjRS.EOF
       If (ObjR1(1)=ObjRS(0)) then
          If (ObjRS("date_urn_scan")=dat1) then
          Response.Write "<TD>" & ObjRS(1) & "</TD>"
          arrDel(r)=arrDel(r)+ObjRS(1)
          Status="Y"
          end if
       end if
       ObjRS.MoveNext
       Wend
'    Response.Write dat1
    dd=dd+1
    dat1=CLng((dd & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
  tempdatefrom=tempdatefrom+1
If (Status<>"Y") then
Response.Write "<TD>" & "-" & "</TD>"
else
Status="N"
end if
wend
'arrComp(r)=CDbl(arrVol(r)/arrDel(r))
Response.Write "<TD><B>" & arrDel(r) & "</B></TD>"
Response.Write "</tr>"
arrDel(r)=0
arrVol(r)=0
arrComp(r)=0
'ObjRS.MoveFirst
ObjR1.MoveNext
Wend

Status=""
'Printing the Totals
tempdateto=dateto
tempdatefrom=datefrom
dd=origdd
dat1=CLng((dd & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
Response.Write "<TR ALIGN=CENTER  bgcolor='#FF9999'>"      
Response.Write "<TD>" & "Totals" & "</TD>"
while (tempdatefrom<=tempdateto)
If ObjRS.BOF = False then
       ObjRS.MoveFirst
End if

      While Not ObjRS.EOF
          'ObjRS.MoveFirst
          If (ObjRS("date_urn_scan")=dat1) then
          arrHorDel(r)=arrHorDel(r)+ObjRS(1)
           Status="Y"
           end if
       ObjRS.MoveNext
       Wend
   dd=dd+1
   dat1=CLng((dd & "" & right("00" & Month(datefrom),2) & "" & Year(datefrom)))
tempdatefrom=tempdatefrom+1
If (Status<>"Y") then
Response.Write "<TD>" & "-" & "</TD>"
else
Status="N"
Response.Write "<TD><B>" & arrHorDel(r) & "</B></TD>"
arrHorTotDel(r)=arrHorTotDel(r)+arrHorDel(r)
arrHorDel(r)=0
end if
wend
Response.Write "<TD><B>" & arrHorTotDel(r) & "</B></TD>"
Response.Write "</TR>"      
'end if
'end if
%></THEAD>
  <DIV></DIV></TABLE></TD></TR></TABLE>
<%
ObjRS.Close

set ObjRS = nothing
set objConn = nothing
%>
<table border="0" cellspacing="1" cellpadding="1" align="center" bordercolor="#ccccff">
                  <tr>
                      <td class="Label" nowrap align="left">Date From</td>
                      <td class="Label" nowrap align="left">Date To</td>
                  </tr>
                  
                  <tr>
                        <td align="left">
                              <input id="txDateFrom" name="txtDateFrom" size="10" maxlength="10" value=<%=Date()-22%>
                              onFocus="javascript:vDateType='3'" onKeyUp="DateFormat(this,this.value,event,false,'3')" onBlur="DateFormat(this,this.value,event,true,'3')">
                        </td>
                        <td align="left">
                              <input id="txtDateTo" name="txtDateTo" size="10" maxlength="10" value=<%=Date()-19%>
                              onFocus="javascript:vDateType='3'" onKeyUp="DateFormat(this,this.value,event,false,'3')" onBlur="DateFormat(this,this.value,event,true,'3')">
                        </td>
<td>
<A href="#">
<IMG onclick="document.formVolumes.submit();" src="cmdbtn_big_report_over.gif" border=0 name=refresh>
</A></td>
</tr></table></form>
</BODY>
</HTML>

[+][-]01/24/03 02:14 AM, ID: 7799024Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Tags: javascript
Sign Up Now!
Solution Provided By: rsashi
Participating Experts: 2
Solution Grade: B
 
[+][-]01/24/03 01:12 AM, ID: 7798759Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:20 AM, ID: 7798795Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/03 01:21 AM, ID: 7798806Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:25 AM, ID: 7798819Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/03 01:29 AM, ID: 7798841Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/03 01:47 AM, ID: 7798923Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:50 AM, ID: 7798940Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:53 AM, ID: 7798950Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:54 AM, ID: 7798955Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 01:55 AM, ID: 7798960Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 02:00 AM, ID: 7798980Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/03 02:18 AM, ID: 7799049Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 02:34 AM, ID: 7799142Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/03 02:50 AM, ID: 7799213Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92