javascript color attribute


  Translation results:

英['kʌlə(r)] 美[ˈkʌlɚ]

n.<Beauty> color, color; skin color, complexion, blood color; pigment, dye; essence

v .<Beauty>Coloring; changing the color of; whitewashing, rendering, coloring; blushing

Third person singular: colors Plural: colors Present participle: coloring Past tense: colored past participle : colored

javascript color attributesyntax

Function:Set the color of the text

Syntax: Object.style.color=color

javascript color attributeexample

<html>
<head>
<script type="text/javascript">
function setColor()
{
document.getElementById("p1").style.color="#ff0000";
document.getElementById("p2").style.color="magenta";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph</p>
<p id="p2">This is also an example paragraph</p>

<input type="button" onclick="setColor()"
value="Change color of text" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A