rrnml
08-25-2006, 07:31 PM
1) Script Title: Xin's Popup Calendar
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/popcalendar2.htm
3) Describe problem:
I inserted the script and it runs, however, I get an Internet explorer error that says
Line: 330
Char: 1
Error: Object required: 'Calendar1'
Code: 0
URL: http://internal/Queries2/retailersalesbycityform2.asp
This is the code from my page. Can anyone tell me what is wrong?
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>Retailer Sales By City</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:Approval_x0020_Level msdt:dt="string"></mso:Approval_x0020_Level>
<mso:Categories msdt:dt="string"></mso:Categories>
<mso:Assigned_x0020_To msdt:dt="string"></mso:Assigned_x0020_To>
</mso:CustomDocumentProperties>
</xml><![endif]-->
<script language="javascript" src="cal2.js">
/*
Xin's Popup calendar script- Xin Yang (http://www.yxscripts.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/
</script>
<script language="javascript" src="cal_conf2.js"></script>
<meta name="Microsoft Border" content="b, default">
</head>
<body>
<%
Dim con
Dim rst
Dim strSQL
Dim strParm1
Dim strParm2
Response.write strParm2
Const adOpenKeyset = 0
Const adLockOptimistic = 1
'Create the objects
Set con = Server.CreateObject("ADODB.Connection")
Set rst = Server.CreateObject("ADODB.Recordset")
' Open the connection to the AS400 Database
con.Open "main", "user", "user1"
con.CommandTimeout = 0
' Create the SQL Query String
' LSR Query String
strSQL = "select distinct nmpdta.arrtlmp.rmdlct " & _
" from nmpdta.arrtlmp where rmdlct <> ' ' Order by rmdlct"
server.ScriptTimeOut = 600
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open strSQL, con, adOpenKeyset, adLockOptimistic
%>
<p align="center">
<font face="Verdana" size="4">Retailer Sales By City</font>
</p>
<div align="center"><center>
<table width="309">
<tr>
<td height="42" align="center" width="303">
<form name="SendDates" method="POST" action="RetailerSalesByCity.asp" target="_blank">
<input type="text" name="fdate" size=20> <small><a href="javascript:showCal('Calendar1')">Select From Date</a></small><p><input type="text" name="tdate" size=20> <small><a href="javascript:showCal('Calendar2')">Select Thru Date</a></small>
</p>
</p>
<p align="center"> </p>
<p>City: <select name="sccity" size="1">
<option></option>
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
wsCity = ucase(rst("rmdlct"))
%> <option value="<%=(wsCity)%>"><%=(wsCity)%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%> </select> </p>
<p><input type="submit" value="Query" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p> </p>
</p>
<p> </td>
</tr>
</table>
</center></div>
<script language=vbscript>
Calendar1.Value = Now()
Calendar2.Value = Now()
call setFromDate
call setThruDate
Sub setFromDate
Dim month, day
If Calendar1.Month < 10 then
month = "0" & Calendar1.Month
Else
month = Calendar1.Month
End If
If Calendar1.Day < 10 then
day = "0" & Calendar1.Day
Else
day = Calendar1.Day
End If
document.SendDates.fdate.value = Calendar1.Year & month & day
End Sub
Sub Calendar1_click
call setFromDate
If document.SendDates.tdate.value < document.SendDates.fdate.value then
call window.alert("The Thru Date must be greater than or equal to the From Date. The Thru Date will be reset to match the From Date.")
Calendar2.Value = Calendar1.Value
call setThruDate
End If
End Sub
Sub setThruDate
Dim month, day
If Calendar2.Month < 10 then
month = "0" & Calendar2.Month
Else
month = Calendar2.Month
End If
If Calendar2.Day < 10 then
day = "0" & Calendar2.Day
Else
day = Calendar2.Day
End If
document.SendDates.tdate.value = Calendar2.Year & month & day
End Sub
Sub Calendar2_click
call setThruDate
If document.SendDates.tdate.value < document.SendDates.fdate.value then
call window.alert("The Thru Date must be greater than or equal to the From Date. The Thru Date will be reset to match the From Date.")
Calendar2.Value = Calendar1.Value
call setThruDate
End If
End Sub
</script>
</body>
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/popcalendar2.htm
3) Describe problem:
I inserted the script and it runs, however, I get an Internet explorer error that says
Line: 330
Char: 1
Error: Object required: 'Calendar1'
Code: 0
URL: http://internal/Queries2/retailersalesbycityform2.asp
This is the code from my page. Can anyone tell me what is wrong?
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>Retailer Sales By City</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:Approval_x0020_Level msdt:dt="string"></mso:Approval_x0020_Level>
<mso:Categories msdt:dt="string"></mso:Categories>
<mso:Assigned_x0020_To msdt:dt="string"></mso:Assigned_x0020_To>
</mso:CustomDocumentProperties>
</xml><![endif]-->
<script language="javascript" src="cal2.js">
/*
Xin's Popup calendar script- Xin Yang (http://www.yxscripts.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/
</script>
<script language="javascript" src="cal_conf2.js"></script>
<meta name="Microsoft Border" content="b, default">
</head>
<body>
<%
Dim con
Dim rst
Dim strSQL
Dim strParm1
Dim strParm2
Response.write strParm2
Const adOpenKeyset = 0
Const adLockOptimistic = 1
'Create the objects
Set con = Server.CreateObject("ADODB.Connection")
Set rst = Server.CreateObject("ADODB.Recordset")
' Open the connection to the AS400 Database
con.Open "main", "user", "user1"
con.CommandTimeout = 0
' Create the SQL Query String
' LSR Query String
strSQL = "select distinct nmpdta.arrtlmp.rmdlct " & _
" from nmpdta.arrtlmp where rmdlct <> ' ' Order by rmdlct"
server.ScriptTimeOut = 600
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open strSQL, con, adOpenKeyset, adLockOptimistic
%>
<p align="center">
<font face="Verdana" size="4">Retailer Sales By City</font>
</p>
<div align="center"><center>
<table width="309">
<tr>
<td height="42" align="center" width="303">
<form name="SendDates" method="POST" action="RetailerSalesByCity.asp" target="_blank">
<input type="text" name="fdate" size=20> <small><a href="javascript:showCal('Calendar1')">Select From Date</a></small><p><input type="text" name="tdate" size=20> <small><a href="javascript:showCal('Calendar2')">Select Thru Date</a></small>
</p>
</p>
<p align="center"> </p>
<p>City: <select name="sccity" size="1">
<option></option>
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
wsCity = ucase(rst("rmdlct"))
%> <option value="<%=(wsCity)%>"><%=(wsCity)%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%> </select> </p>
<p><input type="submit" value="Query" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p> </p>
</p>
<p> </td>
</tr>
</table>
</center></div>
<script language=vbscript>
Calendar1.Value = Now()
Calendar2.Value = Now()
call setFromDate
call setThruDate
Sub setFromDate
Dim month, day
If Calendar1.Month < 10 then
month = "0" & Calendar1.Month
Else
month = Calendar1.Month
End If
If Calendar1.Day < 10 then
day = "0" & Calendar1.Day
Else
day = Calendar1.Day
End If
document.SendDates.fdate.value = Calendar1.Year & month & day
End Sub
Sub Calendar1_click
call setFromDate
If document.SendDates.tdate.value < document.SendDates.fdate.value then
call window.alert("The Thru Date must be greater than or equal to the From Date. The Thru Date will be reset to match the From Date.")
Calendar2.Value = Calendar1.Value
call setThruDate
End If
End Sub
Sub setThruDate
Dim month, day
If Calendar2.Month < 10 then
month = "0" & Calendar2.Month
Else
month = Calendar2.Month
End If
If Calendar2.Day < 10 then
day = "0" & Calendar2.Day
Else
day = Calendar2.Day
End If
document.SendDates.tdate.value = Calendar2.Year & month & day
End Sub
Sub Calendar2_click
call setThruDate
If document.SendDates.tdate.value < document.SendDates.fdate.value then
call window.alert("The Thru Date must be greater than or equal to the From Date. The Thru Date will be reset to match the From Date.")
Calendar2.Value = Calendar1.Value
call setThruDate
End If
End Sub
</script>
</body>