Setting DIV BG Color

[Total: 0    Average: 0/5]

This shows how to create a div and change it’s background color on user events.

Head Code:

<SCRIPT src="http://www.js-examples.com/bin/div_construct.js" type="text/javascript"></SCRIPT>
<script type="text/javascript">
var _x = "This is my Div<br>Look at it's color!"
var div1 = new NewDiv(window, "textpane", _x, 0, 0, 300, 20, 1, "");
</script>

Body Code:

<script type=text/javascript>
div1.output();
div1.show();
</script>
<a href="javascript:div1.setBgColor('#0000FF')">BLUE</a><BR>
<a href="javascript:div1.setBgColor('#FF0000')">RED</a><BR>
<a href="javascript:div1.setBgColor('#00FF00')">GREEN</a>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *