The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
hey all,
Could someone please tell me how can i change the background colour of a text in any container which is added using javascript. For example if i've the following code Code:
<html>
<head><title>JavaScript</title>
</head>
<body>
<div id = 'text'> </div>
<script language='javascript'>
function addText() {
var mycars = new Array()
mycars[0] = "Saab"
mycars[1] = "Volvo"
mycars[2] = "BMW"
var obj = document.getElementById("scroll_text")
for (i=0;i<mycars.length;i++)
{
var mytext=document.createTextNode(mycars[i] + " ")
obj.appendChild(mytext)
}
var ochildNodes = obj.childNodes
var len = ochildNodes.length
// i would like this line to work but it doesn't
ochildNodes[0].style.backgroundColor="#0000FF"
}
addText()
</script>
</body>
</html>
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|