<SCRIPT FOR=window EVENT=onload>
RecordEvent("src="/window", event=" + window.event.type);
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=ondatasetchanged>
FillSortDropDownWithFields(cboSort, this.recordset);
RecordEvent("src=" + event.srcElement.id + ", event=ondatasetchanged");
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=ondatasetcomplete>
RecordEvent("src=" + event.srcElement.id + ", event=ondatasetcomplete, reason=" + event.reason);
// wire up the navigation scriptlet
// by providing it with a reference to the DSO
//scrNavBtns.DSO = this;
</SCRIPT>
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=ondataavailable>
RecordEvent();
</SCRIPT>
<SCRIPT FOR=tblComposers EVENT=onreadystatechange>
RecordEvent("src=" + event.srcElement.id + ", event=" + event.type + ", readyState=" + this.readyState);
</SCRIPT>
<SCRIPT FOR=document EVENT=onbeforeupdate>
// data consumer events will bubble to the document
// alert(window.event.srcElement.value + ", " + tdcComposers.recordset.fields(window.event.srcElement.dataFld).value);
RecordEvent();
</SCRIPT>
<SCRIPT FOR=document EVENT=onafterupdate>
RecordEvent();
g_fFieldsChanged = g_fFieldsChanged + 1
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=onrowenter>
RecordEvent();
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=onrowexit>
RecordEvent();
if (txtBorn.value > txtDied.value)
{
alert("Birth date must be less than or equal to deceased dates");
event.cancelBubble = true;
event.returnValue = false;
}
</SCRIPT>
<SCRIPT FOR=window EVENT=onbeforeunload>
RecordEvent();
if (g_fFieldsChanged > 0)
event.returnValue = "Data has changed.";
</SCRIPT>
<SCRIPT FOR=document EVENT=onerrorupdate>
RecordEvent();
</SCRIPT>
<SCRIPT FOR=txtBorn EVENT=onbeforeupdate>
RecordEvent();
dToday = new Date();
fRet = ValidateDate(parseInt(this.value), 0, dToday.getFullYear());
event.cancelBubble = true;
return fRet;
</SCRIPT>
<SCRIPT FOR=txtDied EVENT=onbeforeupdate>
RecordEvent();
dToday = new Date();
fRet = ValidateDate(parseInt(this.value), 0, dToday.getFullYear());
event.cancelBubble = true;
event.returnValue = fRet;
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=oncellchange>
RecordEvent();
</SCRIPT>
<SCRIPT FOR=tdcComposers EVENT=onrowsinserted>
RecordEvent();
</Script>
<SCRIPT FOR=tdcComposers EVENT=onrowsdelete>
RecordEvent();
</script>
<SCRIPT language="JavaScript">
// perform some basic validation on the date
function ValidateDate(nValue, nMin, nMax)
{
return;
if (isNaN(nValue))
{
alert("Year required");
return false;
}
if (nValue < nMin || nValue > nMax)
{
alert("Invalid year");
return false;
}
return true;
}
function RecordEvent(cEventStr)
{
var fUseOtherWindow = false;
if (RecordEvent.m_winEvents == null && fUseOtherWindow)
{
RecordEvent.m_winEvents = window.open('','','top=0,left=0,height=200,width=500');
if (RecordEvent.m_winEvents == null)
{
return;
}
cContent = '<TEXTAREA ID=txtEvents STYLE="position:absolute;top:10;left:0;height=200;width:500" ID=txtEvents></TEXTAREA>';
RecordEvent.m_winEvents.document.body.insertAdjacentHTML('beforeEnd', cContent);
}
if (cEventStr == null)
{
var oEvent = window.event;
var cID = "unknown";
var cEventType = "unknown";
var cEventReason = "unknown";
if (oEvent != null)
{
cEventType = oEvent.type;
cEventReason = oEvent.reason;
var oSrcElement = oEvent.srcElement;
if (oSrcElement != null)
{
cID = oSrcElement.id;
}
}
cEventStr = "src=" + cID + ", event=" + cEventType + ", reason=" + cEventReason;
}
if (fUseOtherWindow && RecordEvent.m_winEvents != null)
{
txtEvents2 = RecordEvent.m_winEvents.document.body.all('txtEvents');
txtEvents2.value = txtEvents2.value + '
' + cEventStr;
}
txtEvents.value = txtEvents.value + '
' + cEventStr;
}
function ClearEventLog()
{
txtEvents.value = "";
}
// Navigate through the ADO recordset provided by the DSO
function ADONavigate(oElement, oDSO)
{
if (oDSO == null || oElement == null)
{
return;
}
// The value of the button indicates the direction to navigate
cValue = oElement.value;
if (cValue == "<<")
{
oDSO.recordset.MoveFirst();
}
else if (cValue == " < ")
{
oDSO.recordset.MovePrevious();
if (oDSO.recordset.BOF)
{
oDSO.recordset.MoveFirst();
}
}
else if (cValue == " > ")
{
oDSO.recordset.MoveNext();
if (oDSO.recordset.EOF)
{
oDSO.recordset.MoveLast();
}
}
else if (cValue == ">>")
{
oDSO.recordset.MoveLast();
}
}
// Add the specified value/text to the dropdown list
function AddItemToDropDown(oDropDown, cValue, cText)
{
oOption = document.createElement('OPTION');
oOption.value = cValue;
oOption.text = cText;
oDropDown.add(oOption);
}
// Fill the specified dropdown with the metadata from the specified ADO RecordSet
function FillSortDropDownWithFields(oDropDown, oRecordSet)
{
// only do this once. leave it to the caller to clear the drop-down otherwise
if (oDropDown.options.length > 0)
return;
AddItemToDropDown(oDropDown, "None", "None"); // default
// add each of the columns in the data set to the drop-down
for (i = 0; i < oRecordSet.fields.count; i++)
{
oField = oRecordSet.fields(i);
AddItemToDropDown(oDropDown, oField.name, oField.name);
}
cboSort.selectedIndex = 0;
}
function AllowEdit()
{
EnableEditing(true);
cmdEdit.value = "Don't Edit";
cmdEdit.onclick = DisableEdit;
cmdInsert.disabled=false;
}
function DisableEdit()
{
EnableEditing(false);
cmdEdit.value = "Edit";
cmdEdit.onclick = AllowEdit;
cmdInsert.disabled=true;
}
function EnableEditing(fEnable)
{
txtFirst.readOnly = !fEnable;
txtLast.readOnly = !fEnable;
txtBorn.readOnly = !fEnable;
txtDied.readOnly = !fEnable;
txtBio.readOnly = !fEnable;
cboOrigin.disabled = !fEnable;
}
</SCRIPT>
<SCRIPT FOR=document EVENT=onclick>
// If the event bubbling up to the document comes from an object
// the id of which begins with "cmdNav", navigate through the recordset
oElement = window.event.srcElement;
if (oElement.id.substring(0,6) == "cmdNav")
{
ADONavigate(oElement, tdcComposers);
}
</SCRIPT>
<SCRIPT FOR=cboOriginFilter EVENT=onchange>
cValue = this.options[this.selectedIndex].value;
tdcComposers.object.Filter = (cValue == 'All' ? '' : 'Origin=' + cValue);
tdcComposers.Reset();
</SCRIPT>
<SCRIPT FOR=cboSort EVENT=onchange>
cValue = this.options[this.selectedIndex].value;
tdcComposers.object.Sort = (cValue == 'None' ? '' : cValue);
tdcComposers.Reset();
</SCRIPT>