How to change style of a text

Hi All IM having a problem. situation is there is a subform in which i have written A-Z & in every character im calling an agent. And calling that subform in $$Search form.

now i have to change the style of each character whenever i clicked on it & rest of all should be same.

Regards

Sanjay

Subject: How to change style of a text…

Hi Sanjay,U have to modify & use following code

as per ur requirement.

just write down it on ONcClick event

OnClick:

this.style.color = “white”;

for(i=0;i<document.all.length;i++){

if((document.all[i] != this) && (document.all[i].style.color == "white")){

	document.all[i].style.color = "black";

	break;

}	

}

Subject: RE: How to change style of a text…

Cool – that will set every element and data node on the document except the clicked entity to black, regardless of what colour it should have been. And it uses document.all, so the page will be ruined in Internet Explorer, and will cause a JavaScript error in every other browser.

There has to be a way to identify the targets of the change. In every practical sense, that means using passthru HTML to put an element (a span or a heading tag, or an existing link tag) with a class around the clickable elements. You can then use document.getElementsByTagName() to get the collection of all tags matching the target, then iterate through the collection checking the className to make sure you’re only hitting the targets you intend to hit, and using “this” to make sure you don’t reset the clicked item.

Subject: RE: How to change style of a text…

hi PrithviThe code u mentioned i wrote it & it is working fine. But the prob. is that when im trying to click a button within this code it’s not working.

Here is the code which i have written on the hotspot of a text


document.forms[0].selection_formula.value=“A”;

document.forms[0].selection_formula_lower.value=“a”;

document.forms[0].runA2Z.click();

this.style.color = “black”;

for(i=0;i<document.all.length;i++)

{

if((document.all[i] != this) && (document.all[i].style.color == “black”))

{

document.all[i].style.color = “red”;

break;

}

}

Regards

Sanjay