-
JavaScript - Changing DIV background colour
Hi All, I am practice writing Web Application using JavaScript. I have 2 buttons, HELLO and LENNIE. When click on LENNIE, I want to change the background colour of DivHello to "Blue" but no joy. Could someone pls point me to the right direction. Thanks heaps.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Lennie Testing Javascript</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script id="clientEventHandlersJS" language="javascript">
<!--
function btnHello_onclick()
{
divHello.innerHTML ="Hullo 123 John";}
function btnLennie_onclick()
{
divHello.Style.BackGroundColor = "Blue";
divHello.innerHTML = "Hullo Lennie";}
</script>
</head>
<body ms_positioning="GridLayout" bgColor="buttonface">
<DIV id="divHello" style="DISPLAY: inline; Z-INDEX: 101; LEFT: 96px; WIDTH: 296px; POSITION: absolute; TOP: 56px; HEIGHT: 23px"
ms_positioning="FlowLayout"></DIV>
<INPUT id="btnHello" style="Z-INDEX: 102; LEFT: 120px; WIDTH: 71px; POSITION: absolute; TOP: 128px; HEIGHT: 35px"
type="button" value="Hello" name="Button1" language="javascript" onclick="return btnHello_onclick()">
<INPUT id="BtnLennie" style="Z-INDEX: 103; LEFT: 240px; WIDTH: 58px; POSITION: absolute; TOP: 128px; HEIGHT: 32px"
type="button" value="Lennie" name="Button2" language="javascript" onclick="return btnLennie_onclick()">
<DIV id=DivColor
style="DISPLAY: inline; Z-INDEX: 104; LEFT: 96px; WIDTH: 296px; POSITION: absolute; TOP: 88px; HEIGHT: 19px"
ms_positioning="FlowLayout"></DIV>
</body>
</html>
Cheers,
Lennie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks