HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
change colors
Post new topic   Reply to topic    HTML Help Forum -> HTML Form
View previous topic :: View next topic  
Author Message
eric123



Joined: 14 Dec 2004
Posts: 9

PostPosted: Sun Jan 09, 2005 5:59 pm     change colors Reply with quote

How do i make it so when you click on the form, like a text box or area it changes bg colors?
nagasree



Joined: 21 Sep 2004
Posts: 82
Location: Hyderabad, India

PostPosted: Wed Jan 19, 2005 5:23 am     Reply with quote

Code:

<HTML>
<BODY style="background-color:#ffffff";>
<INPUT TYPE="button" name="ChangeColor" value="Change Color" onclick="ChangeBgColor()">
</BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
var colorArray = new Array("#ffffff","#000080","#e5e5e5","#a4c2d3","#343434");
var colIndex = 0;
function ChangeBgColor()
{
   colIndex = colIndex + 1;
   if(colIndex >= colorArray.length) colIndex = 0;   
   document.body.style.backgroundColor = colorArray[colIndex];
}
//-->
</SCRIPT>
</HTML>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial