I am having a problem. I have a page - simplified source code below. What I am after is for users to click either of two tickboxes - this will highlight one set of input fields and disable the other and vice versa. This works fine. However, I would like to change the colour of the text for the disabled inputs to grey (i.e 'Exchange Trans ID') but try as I might I cannot do it - (I presume it is something like setting the document.field.style.color="grey" within the function and defining the style in the field itself.) I generally get undefined variable error messages or variable 'document.field.style is null or not an object' error messages.
I've tried breaking down the page into a number of forms, adding / removing internal and external stylesheets but to not avail. Is this sort of dynamic color change possible at all from a script such as mine ? oh yes - it only has to work for IE4/5/5.5 at the moment and the references to the external stylesheets (class="pageheader" etc) aren't necessary if I need to remove them.
Any help or general pointers would be very gratefully received.
Many thanks,
Joe.:-(
<SCRIPT languae="Javascript">
function disableChoices(dWhat) {
if (dWhat == "Criteria"
{
if (document.select_audit_trail.OrderID.checked == true) {
document.select_audit_trail.Criteria.checked = false;
}
else {document.select_audit_trail.Criteria.checked = true;
}
}
if (dWhat == "OrderID"
{
if (document.select_audit_trail.Criteria.checked) {
document.select_audit_trail.OrderID.checked = false;
}
else {document.select_audit_trail.OrderID.checked = true;
}
}
if (document.select_audit_trail.Criteria.checked) {
// the exch and our elements
document.select_audit_trail.Exch_TransID.disabled = true;
document.select_audit_trail.Exch_OrderID.disabled = true;
document.select_audit_trail.Us_TransID.disabled = true;
document.select_audit_trail.Us_TransID.disabled = true;
// document.OrderID_Table.style="color:red";
// the Criteria elements
document.select_audit_trail.Portfolio.disabled = false;
document.select_audit_trail.Account.disabled = false;
document.select_audit_trail.Trade_Date.disabled = false;
document.select_audit_trail.Revision_Date.disabled = false;
}
else {
// the exch and our elements
document.select_audit_trail.Exch_TransID.disabled = false;
document.select_audit_trail.Exch_OrderID.disabled = false;
document.select_audit_trail.Us_TransID.disabled = false;
document.select_audit_trail.Us_TransID.disabled = false;
// the Criteria elements
document.select_audit_trail.Portfolio.disabled = true;
document.select_audit_trail.Account.disabled = true;
document.select_audit_trail.Trade_Date.disabled = true;
document.select_audit_trail.Revision_Date.disabled = true;
}
}
</SCRIPT>
<BODY>
<FORM NAME="select_audit_trail">
<TABLE class="pageheader" CELLSPACING="0">
<TR><TD ID="PHhead" class="PHh" colspan="2">Selection Criteria</TD><TR>
</TABLE>
<HR>
<TABLE class="pageheader">
<TR><TD ID="Btitle" class="Bti">Select by Order ID</TD>
<TD><INPUT type="Checkbox" name="OrderID" onclick="disableChoices('Criteria')" unchecked></INPUT></TR>
</TABLE>
<BLOCKQUOTE>
<TABLE name="OrderIDTable">
<TR><TD>Exchange Trans ID</TD><TD><INPUT name="Exch_TransID"></INPUT></TD></TR>
<TR><TD>Exchange Order ID</TD><TD><INPUT name="Exch_OrderID"></INPUT></TD></TR>
<TR><TD>MAKO Trans ID</TD><TD><INPUT name="MAKO_TransID"></INPUT></TD></TR>
<TR><TD>MAKO Order ID</TD><TD><INPUT name="MAKO_OrderID"></INPUT></TD></TR>
</TABLE>
</BLOCKQUOTE>
<TABLE class="pageheader">
<TR><TD ID="Btitle" class="Bti">Select by User Criteria</TD>
<TD><INPUT type="Checkbox" name="Criteria" onclick="disableChoices('OrderID')" checked></INPUT>
</TR>
</TABLE>
<BLOCKQUOTE>
<TABLE name="Criteria_Table">
<TR><TD>Inventory</TD><TD><SELECT name="Portfolio"><OPTION value=''>-- select --</OPTION>#database generated options</SELECT></TD></TR>
<TR><TD>Label</td><TD><SELECT name="Account"><OPTION value=''>-- select --</OPTION>#database generated</SELECT></TD></TR>
<TR><TD>Trade Date</TD><TD><INPUT name="Trade_Date"></INPUT></TD></TR>
<TR><TD>Revision Date</TD><TD><INPUT name="Revision_Date"></INPUT></TD></TR>
</TABLE>
</BLOCKQUOTE>
</FORM>
</BODY>
</HTML>
I've tried breaking down the page into a number of forms, adding / removing internal and external stylesheets but to not avail. Is this sort of dynamic color change possible at all from a script such as mine ? oh yes - it only has to work for IE4/5/5.5 at the moment and the references to the external stylesheets (class="pageheader" etc) aren't necessary if I need to remove them.
Any help or general pointers would be very gratefully received.
Many thanks,
Joe.:-(
<SCRIPT languae="Javascript">
function disableChoices(dWhat) {
if (dWhat == "Criteria"
if (document.select_audit_trail.OrderID.checked == true) {
document.select_audit_trail.Criteria.checked = false;
}
else {document.select_audit_trail.Criteria.checked = true;
}
}
if (dWhat == "OrderID"
if (document.select_audit_trail.Criteria.checked) {
document.select_audit_trail.OrderID.checked = false;
}
else {document.select_audit_trail.OrderID.checked = true;
}
}
if (document.select_audit_trail.Criteria.checked) {
// the exch and our elements
document.select_audit_trail.Exch_TransID.disabled = true;
document.select_audit_trail.Exch_OrderID.disabled = true;
document.select_audit_trail.Us_TransID.disabled = true;
document.select_audit_trail.Us_TransID.disabled = true;
// document.OrderID_Table.style="color:red";
// the Criteria elements
document.select_audit_trail.Portfolio.disabled = false;
document.select_audit_trail.Account.disabled = false;
document.select_audit_trail.Trade_Date.disabled = false;
document.select_audit_trail.Revision_Date.disabled = false;
}
else {
// the exch and our elements
document.select_audit_trail.Exch_TransID.disabled = false;
document.select_audit_trail.Exch_OrderID.disabled = false;
document.select_audit_trail.Us_TransID.disabled = false;
document.select_audit_trail.Us_TransID.disabled = false;
// the Criteria elements
document.select_audit_trail.Portfolio.disabled = true;
document.select_audit_trail.Account.disabled = true;
document.select_audit_trail.Trade_Date.disabled = true;
document.select_audit_trail.Revision_Date.disabled = true;
}
}
</SCRIPT>
<BODY>
<FORM NAME="select_audit_trail">
<TABLE class="pageheader" CELLSPACING="0">
<TR><TD ID="PHhead" class="PHh" colspan="2">Selection Criteria</TD><TR>
</TABLE>
<HR>
<TABLE class="pageheader">
<TR><TD ID="Btitle" class="Bti">Select by Order ID</TD>
<TD><INPUT type="Checkbox" name="OrderID" onclick="disableChoices('Criteria')" unchecked></INPUT></TR>
</TABLE>
<BLOCKQUOTE>
<TABLE name="OrderIDTable">
<TR><TD>Exchange Trans ID</TD><TD><INPUT name="Exch_TransID"></INPUT></TD></TR>
<TR><TD>Exchange Order ID</TD><TD><INPUT name="Exch_OrderID"></INPUT></TD></TR>
<TR><TD>MAKO Trans ID</TD><TD><INPUT name="MAKO_TransID"></INPUT></TD></TR>
<TR><TD>MAKO Order ID</TD><TD><INPUT name="MAKO_OrderID"></INPUT></TD></TR>
</TABLE>
</BLOCKQUOTE>
<TABLE class="pageheader">
<TR><TD ID="Btitle" class="Bti">Select by User Criteria</TD>
<TD><INPUT type="Checkbox" name="Criteria" onclick="disableChoices('OrderID')" checked></INPUT>
</TR>
</TABLE>
<BLOCKQUOTE>
<TABLE name="Criteria_Table">
<TR><TD>Inventory</TD><TD><SELECT name="Portfolio"><OPTION value=''>-- select --</OPTION>#database generated options</SELECT></TD></TR>
<TR><TD>Label</td><TD><SELECT name="Account"><OPTION value=''>-- select --</OPTION>#database generated</SELECT></TD></TR>
<TR><TD>Trade Date</TD><TD><INPUT name="Trade_Date"></INPUT></TD></TR>
<TR><TD>Revision Date</TD><TD><INPUT name="Revision_Date"></INPUT></TD></TR>
</TABLE>
</BLOCKQUOTE>
</FORM>
</BODY>
</HTML>