javascript font changing - need help

liunx

Guest
i need a code that says "if the number value is negative, make the number (including the negative sign) red. if the value is zero, make the number white. if the value is positive, make the value green AND put a positive sign in front". (because by default positive numbers don't have the + in front, the number is just written). <br />
<br />
i guess its kinda like a conditional statement thing, but i can't figure it out, please help<!--content-->If you use cascading style sheets, you can modify the font color under certain conditions. If they click on a certain thing, you can add an OnClick even handler to that hyperlink, which will call Javascript to modify it.In the Javascript, you can modify the actual layers or divs by using:<br />
document.all.divname.parameter <br />
<br />
filling in divname with your div name and parameter with the thing you want to change, in this case font color. This is how its done in IE, but netscape does something with the layers array.<!--content-->thanx, but i need it to be done within a function. you see, i'm going to have over a hundred js files that I will call "outside source files" for now. And then I have the main html page. Every outside source file has the same set of variables,but different values. for example, if AAA.js has the following:<br />
<br />
eNA = 3<br />
eNM = 4<br />
eDFI = -3<br />
ePL = 500<br />
<br />
then BBB.js has the following:<br />
<br />
eNA = 3<br />
eNM = 7<br />
eDFI = -7<br />
ePL = 200<br />
<br />
and so on.<br />
<br />
the actual html page has many operation functions in it, for example multiplying eNM with eDFI. And also included in the function is "document.write", so the end result would be writeen down. BUT, i need all negative results to be red, and positive results to be green. inside the function. i need a code that can be put inside the function (not for the whole page, since only certain functions will have this color thing).<br />
<br />
thx<!--content-->
 
Back
Top