I've tried this,when the user enters a value in a textbox,the color of the DayTotalkWh readings should change automatically.Please help me I don't get this!.Instead, the whole text color changes.
Here is the code:
<HTML>
<HEAD>
</TITLE>Daily Meter Readings </TITLE>
<script type="text/javascript">
var Readme = document.getElementsByTagName(Readme);
this.Readme;
</HEAD>
<BODY bgcolor="pink">
<OBJECT CLASSID = "clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" ID = Readings>
<PARAM NAME ="DataURL" value ="Readings.csv">
<PARAM NAME ="UseHeader" value ="True">
</OBJECT>
<FORM>
<TABLE BORDER = 1 DATASRC ="#Readings">
<THEAD>
<TR>
<TH>Date <TH>DayTotalkWh
<TBODY>
<TR>
<TD><SPAN DATAFLD = Date>10/24/2011</SPAN>
<TD><SPAN DATAFLD = DayTotalkWh>50</SPAN>
</TABLE>
<H3>Why the colour of the whole text is changing? </H3>
<H3>Here is the obstacle,when a user enter a value in the textbox only DayTotalkWh values should change colour</H3>
<HTML>
<HEAD>
</TITLE>Daily Meter Readings </TITLE>
<script type="text/javascript">
var Readme = document.getElementsByTagName(Readme);
this.Readme;
function ChangeTextColor(value)
{
if(value > 40)
{
document.getElementById("day").style.color="red";
this.focus();
}
else if(value < 40)
{
document.getElementById("day").style.color="green";
this.focus();
}
else
{
document.getElementById("day").style.color="amber";
this.focus();
}
}
</script>
</HEAD>
<BODY bgcolor="pink">
<OBJECT CLASSID = "clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" ID = Readings>
<PARAM NAME ="DataURL" value ="Readings.csv">
<PARAM NAME ="UseHeader" value ="True">
</OBJECT>
<FORM>
<TABLE BORDER = 1 DATASRC ="#Readings">
<THEAD>
<TR>
<TH>Date <TH>DayTotalkWh
<TBODY>
<TR>
<TD><SPAN DATAFLD = Date>10/24/2011</SPAN>
<TD><SPAN DATAFLD = DayTotalkWh id="day">50</SPAN>
</TABLE>
<H3>Why the colour of the whole text is changing? </H3>
<H3>Here is the obstacle,when a user enter a value in the textbox only DayTotalkWh values should change colour</H3>
Enter Values <input type="textbox" name="Readme" onChange="if(!ChangeTextColor(this.value));this.focus()"><BR><BR>
<IMG src=""><BR><BR>
<INPUT type="reset">
</FORM>
</BODY>
</HTML>
Thanks a lot Xelawho,but the problem is still there.No changes!The page remains unresponsive.I've tried to change it in other way, no color change.Please any body out there to help me. I too still working on this.
Thanks JunkMale, Yes Sir, by applying this.focus() function, I meant targetObject.focus(); to apply focus to the changed object,but does not necessarily need to be there so it can be omitted.Again it doesn't work.This is going to be an issue!
Bookmarks