Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html with css and javascript?

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
hi,
i has posted it on HTML,XHTML & CSS forum. There has told to ask on the JAVA Script forum.

i have .css as:

...

.statusPENDING { font-family: arial,serif; font-size: 8pt; background-color: #ACACAC; }
.statusOK { font-family: arial,serif; font-size: 8pt; background-color: #33FF00; }

...

and I am working with html que use this .css
I need have 2 different colors of the .statusOK (for exemple red and green) depending of the first character of the line.
It use cgis, but I dind't have to change it, only I can change css and html files.
How can I do it?

Thanks.
 
I need have 2 different colors of the .statusOK (for exemple red and green) depending of the first character of the line.

What is the line you refer to?

You could create a second class in the css and in the HTML put a javascript function that will run onload. In that function search for each element you want to affect, test the first character and set the classname for it.
It depends a lot on how your HTML is setup though. Would each "line" have it's own class definition or otherwise be wrapped in some kind of HTML container that could be identified separately? If not your job is a lot harder.


At my age I still learn something new every day, but I forget two others.
 
If you post the relevant HTML created by your CGI, I can help. As is, I don't have enough information.

[monkey][snake] <.
 
hi.
I post 2 html files:

index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<META HTTP-EQUIV='content-type' CONTENT='text/html;charset=euc-jp'>
<TITLE>Nagios</TITLE>
</HEAD>
<FRAMESET BORDER="0" FRAMEBORDER="0" FRAMESPACING="0" COLS="220,*">
<FRAME SRC="side.html" NAME="side" TARGET="main">
<FRAME SRC="main.html" NAME="main">
</FRAMESET>

<NOFRAMES>
<!-- ¤³¤Î¥Ú¡¼¥¸¤òɽ¼¨¤¹¤ë¤Ë¤Ï¡¢¥Õ¥ì¡¼¥à¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥Ö¥é¥¦¥¶¤¬É¬ÍפǤ¹¡£ -->
<p>
<center>
<h2>Nagios</h2>
<a href=" alt="Nagios Home">Copyright (c) 1999-2001 Ethan A. Galstad<br>
</center>
</p>
<p>
<i>¢¨¤³¤Î¥Ú¡¼¥¸¤òɽ¼¨¤¹¤ë¤Ë¤Ï¡¢¥Õ¥ì¡¼¥à¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥Ö¥é¥¦¥¶¤¬É¬ÍפǤ¹¡£</i>
</p>
</NOFRAMES>

</HTML>

main.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<META HTTP-EQUIV='content-type' CONTENT='text/html;charset=euc-jp'>
<TITLE>Nagios</TITLE>

<STYLE type="text/css">

<!--

.main { font-family: arial,serif; background-color : white; color: black; font-size: 12pt; }

.version { font-family: arial,serif; text-align: center; color: red; font-weight: bold; font-size: 18pt; }
.releaseDate { font-family: arial,serif; text-align: center; font-size: 12pt; }

.disclaimer { font-family: arial,serif; text-align: center; font-size: 8pt; }

.infoBox { font-family: arial,serif; font-size : 12pt; background-color : #A5A3A3; padding: 2; }

-->

</STYLE>

</HEAD>

<BODY CLASS="main">

<P>
<div align="center">
<a href=" target="_blank"><IMG SRC="images/logofullsize.jpg" BORDER="0" ALT="Nagios"></a><br clear=all>
Copyright (c) 1999-2006 Ethan Galstad<br>
</div>
</P>

<P>
<div align=center>
<div align=center CLASS="version">Version 2.6</div>
<div align=center CLASS="releaseDate">November 27, 2006</div>
</div>
</P>

<div align="center">
<table border="1" width="75%" CLASS="infoBox" CELLSPACING=0 CELLPADDING=0>
<tr CLASS="infoBox">
<td>
<table border=0 CLASS="infoBox">

<tr CLASS="infoBox">
<td CLASS="infoBox">
<b><u>¿·µ¬¥¤¥ó¥¹¥È¡¼¥ë:</u></b><br><br>
<p>
¤â¤·¡¢Nagios&reg;¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿Ä¾¸å¤Ë¤³¤Î²èÌ̤òɽ¼¨¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Àµ¤·¤¯²ÔƯ¤µ¤»¤ë¤¿¤á¤Ë¤â¤Þ¤º<a href="docs/">¥É¥­¥å¥á¥ó¥È</a>¤òÆɤó¤Ç¤¯¤À¤µ¤¤¡£
</p>
<p>
<a href="docs/whatsnew.html">¤³¤³¤ò¥¯¥ê¥Ã¥¯</a> ¤¹¤ë¤È¤³¤Î¥ê¥ê¡¼¥¹¤ÇÄɲ䵤줿¿·µ¡Ç½¤Ê¤É¤Î¾ðÊó¤ò¸«¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
</p>
</td>
</tr>

<tr CLASS="infoBox">
<td CLASS="infoBox" STYLE="padding-top: 20px;">
<b><u>¾ÜºÙ¾ðÊó:</u></b><br><br>
<p>
Nagios¤Î¥Û¡¼¥à¥Ú¡¼¥¸(<a href=" target="_top"> ¤Ë¥Ð¥°¥Õ¥£¥Ã¥¯¥¹¡¢¥¢¥Ã¥×¥°¥ì¡¼¥É¡¢¥µ¥Ý¡¼¥È¤Ê¤É¤Î¾Ü¤·¤¤¾ðÊ󤬷Ǻܤµ¤ì¤Æ¤¤¤Þ¤¹¡£
</p>
</td>
</tr>

</table>
</td>
</tr>
</table>
</div>

<br clear=all>

<div align="center">
<a href=" target="_top"><img src="images/weblogo1.png" border="0" alt="Monitored by Nagios"></a>
</div>

<br clear=all>

<div align="center" CLASS="disclaimer">
Nagios¤ÈNagios¤Î¥í¥´¤Ï Ethan Galstad ¤¬½êÍ­¤¹¤ëÅÐÏ¿¾¦É¸¤Ç¤¹¡£<br>
Nagios¤Ïµ¡Ç½À­¡¢¾¦ÉÊÀ­¤Þ¤¿¤ÏÆÃÄê¤ÎÌÜŪ¤ÎŬ¹çÀ­¤Ê¤É¤ò´Þ¤á¡¢¤¤¤«¤Ê¤ëÊݾڤâ¹Ô¤¤¤Þ¤»¤ó¡£
</div>


</BODY>
</HTML>


Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top