Undersøge tekst og ændre image ved click
Jeg har en række objekter som indeholder en .net kontrol som brugeren skal udfylde. Når det er udfyldt placeres værdierne i KeysString.Jeg har brug for at det tilhørende billede (ex. <img name="object_arrow" align="middle" src="../../common/image/rightlight.gif">)
skifter til rightlight_green.gif når UpdatingTree.KeysString<>''
Den skal tjekke indholdet af UpdatingTree.KeysString både ved load og ved click på <td>
Menigen er at når der er udfyldt noget i kontrollen så bliver pilen grøn, og brugeren kan se at feltet er udfyldt.
Der findes UpdatingTree til UpdatingTree5 (6 kontroller)
Her er noget af min kode:
function ClearAll()
{
//document.frmKeys.txtHiddenKeys.value = "";
//document.frmKeys.txtHiddenText.value = "";
UpdatingTree.Clear
UpdatingTree1.Clear
UpdatingTree2.Clear
UpdatingTree3.Clear
UpdatingTree4.Clear
UpdatingTree5.Clear
}
function visObject(ref)
{
imgname = ref.id + "_arrow"
if (ref.style.display=='none')
{
ref.style.display='inline'
document[imgname].src = "../../common/image/leftlight.gif"
}
else if (ref.style.display=='inline')
{
ref.style.display='none'
{document[imgname].src = "../../common/image/rightlight.gif"}
}
}
function SkjulObjekter()
{
sector.style.display='none';
object.style.display='none';
discipline.style.display='none';
service.style.display='none';
Geography.style.display='none';
Language.style.display='none';
}
</SCRIPT>
<style>
body {
overflow: auto;
height: 100%;
}
</style>
</HEAD>
<BODY onload="DDBinit();SkjulObjekter();" bgcolor="#c0c0c0">
<table width="450px">
<tr>
<td valign="top" onclick="visObject(sector);"><img name="sector_arrow" align="middle" src="../../common/image/rightlight.gif">Sector</td>
<td id="sector" style="display: inline;"><OBJECT id="UpdatingTree" height="250" width="275" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
<tr>
<td valign="top" onclick="visObject(object);"><img name="object_arrow" align="middle" src="../../common/image/rightlight.gif">Object</td>
<td id="object" style="display: inline;"><OBJECT id="UpdatingTree1" height="250" width="300" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
<tr>
<td valign="top" onclick="visObject(discipline);"><img name="discipline_arrow" align="middle" src="../../common/image/rightlight.gif">Discipline</td>
<td id="discipline" style="display: inline;"><OBJECT id="UpdatingTree2" height="250" width="300" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
<tr>
<td valign="top" onclick="visObject(service);"><img name="service_arrow" align="middle" src="../../common/image/rightlight.gif">Service</td>
<td id="service" style="display: inline;"><OBJECT id="UpdatingTree3" height="250" width="300" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
<tr>
<td valign="top" onclick="visObject(Geography);"><img name="Geography_arrow" align="middle" src="../../common/image/rightlight.gif">Geography</td>
<td id="Geography" style="display: inline;"><OBJECT id="UpdatingTree4" height="250" width="300" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
<tr>
<td valign="top" onclick="visObject(Language);"><img name="Language_arrow" align="middle" src="../../common/image/rightlight.gif">Language</td>
<td id="Language" style="display: inline;"><OBJECT id="UpdatingTree5" height="250" width="300" classid="../UpdatingTree.dll#Controls.UpdatingTree" VIEWASTEXT></OBJECT></td>
</tr>
</table>
<form name="frmKeys" onsubmit="return Valider()" method="post" Target="_self">
<input type="hidden" name="Keys">
<input type="hidden" name="Text">
</form>