CSS + JS control text

Source: Internet
Author: User
<HTML>
<Head>
<Title> CSS + JS control text </title>
</Head>
<Body>
<Style>
Body {font-size: 8pt; font-family: Arial ;}
. Datahead {font-size: 8pt; font-family: Arial; Background-color: #505050; color: # ffffff; Border: "1 solid"; border-top-color: "#909090"; border-left-color: "#909090"; border-right-color: "#303030"; border-bottom-color: "#303030 ";}
. Dataitem {font-size: 8pt; font-family: Arial; Background-color: # c0c0c0; color: #000000; Border: "1 solid"; border-top-color: "# cfcfcf"; border-left-color: "# cfcfcf"; border-right-color: "#505050"; border-bottom-color: "#505050 ";}
</Style>
<SCRIPT>
Function fnsetdata (){
For (VAR I = 1; I <odata. Rows. length; I ++)
{
VaR oworkrow = odata. Rows (I );
Oworkrow. cells (1). innertext = eval ("oscratch. Style." + oworkrow. cells (0). innertext );
Oworkrow. cells (2). innertext = eval ("oscratch. runtimestyle." + oworkrow. cells (0). innertext );
Oworkrow. cells (3). innertext = eval ("oscratch. currentstyle." + oworkrow. cells (0). innertext );
}
}
Function fnchangestyle (ostyle, svalue ){
If (svalue. indexof ("clear")>-1 ){
Svalue = "";
}
Eval ("oscratch. runtimestyle." + ostyle + "= '" + svalue + "'");
Fnsetdata ();
}
Function fninit (){
Fnsetdata ();
}
Window. onload = fninit;
</SCRIPT>
<H1> style sheet controls the corresponding text <Div id = "oscratch" style = "border: '5 solid'; border-color: #101010; Background-color: # cfcfcf; color: #000000; font-size: 12pt; font-family: 'arial'; "> before the Gulf War, Saddam was a" Lion "in the eyes of many Arab groups, especially Palestine ", it seems that only he can lead the Arab brothers to defeat Israel and liberate the occupied territory. They hoped that Saddam would allow the United Arab countries to unite and then use Iraq's abundant oil resources to build a modern power. However, after more than a decade, expectations for Saddam gradually disappeared. Many Palestine refugees told reporters that the Iraqi leader had no faith, every day, you only need to think about how to keep your dominance. In those years, they were excited by the 39 "Flying leg" missiles launched by Saddam to Israel, and thought they were "turning over now". Now these hopes are all lost.
<P> from Cairo to Amman, when talking about Iraq, ordinary people are not worried about whether the suffering people in this country can withstand the indiscriminate bombing of all kinds of new weapons in the United States, although they are no longer "interested" in the volatile Saddam regime, their aversion to the arrogant acts of the United States has not diminished. However, there are still many Palestine who are very supportive of Saddam, because only the leader insisted on condemn Israel. Although such verbal criticism does not seem to have any effect, it can at least give them a little comfort. The Arab saying that the US war against Iraq did not aim at promoting democracy at all. Instead, it took a fancy to the abundant local oil resources and determined its dominance in the Middle East.
</Div>
<P>
<Table id = "odata">
<Tr>
<TD class = "datahead"> CSS property </TD>
<TD class = "datahead"> style </TD>
<TD class = "datahead"> runtimestyle </TD>
<TD class = "datahead"> currentstyle </TD>
<TD class = "datahead"> <B> select a value </B> </TD>
</Tr>
<Tr>
<TD class = "dataitem"> backgroundcolor </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> <select class = "dataitem" onchange = "fnchangestyle ('backgroundcolor', this. Options (this. selectedindex). Text)">
<Option> Indigo
<Option> mistyrose
<Option> mediumorchid
<Option> Pink
<Option> yellow
<Option> clear this runtime Style
</SELECT>
</TD>
</Tr>
<Tr>
<TD class = "dataitem"> bordercolor </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> <select class = "dataitem" onchange = "fnchangestyle ('bordercolor', this. Options (this. selectedindex). Text)">
<Option> Red
<Option> green
<Option> blue
<Option> yellow
<Option> clear this runtime Style
</SELECT>
</TD>
</Tr>
<Tr>
<TD class = "dataitem"> color </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> </TD>
<TD class = "dataitem"> <select class = "dataitem" onchange = "fnchangestyle ('color', this. Options (this. selectedindex). Text)">
<Option> Red
<Option> White
<Option> blue
<Option> yellow
<Option> Silver
<Option> gold
<Option> clear this runtime Style
</SELECT>
</TD>
</Tr>
</Table>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.