Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet servlet backgorund color change

Have Programming Question? Ask it here!
 
 
 


shivangi asati
servlet backgorund color change
1 Answer(s)      4 years ago
Posted in : JSP-Servlet


code for servlet that changes background color in every 10 seconds.

Advertisement
View Answers

July 23, 2010 at 12:27 PM


Hi Friend,

Try the following code:

import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ChangeBackgroundColor extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
PrintWriter out = response.getWriter();
out.println("<html><head>");
out.println("<script>function setbackground(){window.setTimeout( 'setbackground()', 10000);var index = Math.round(Math.random() * 9);var ColorValue = 'FFFFFF'; ");
out.println("if(index == 1)ColorValue = 'FFCCCC'; ");
out.println("if(index == 2)ColorValue = 'CCAFFF';");
out.println("if(index == 3)ColorValue = 'A6BEFF'; ");
out.println("if(index == 4)ColorValue = '99FFFF'; ");
out.println("if(index == 5)ColorValue = 'D5CCBB'; ");
out.println("if(index == 6)ColorValue = '99FF99'; ");
out.println("if(index == 7)ColorValue = 'FFFF99'; ");
out.println("if(index == 8)ColorValue = 'FFCC99'; ");
out.println("if(index == 9)ColorValue = 'CCCCCC'; ");
out.println("document.bgColor=ColorValue;}</script></head>");
out.println("<body onLoad='setbackground();'><h1>Hello World</h1></body></html>");
}
}

Thanks


Related Tutorials/Questions & Answers:
servlet backgorund color change - JSP-Servlet
servlet backgorund color change  code for servlet that changes background color in every 10 seconds.  Hi Friend, Try the following code: import java.io.*; import java.sql.*; import java.util.*; import
Java Servlet Change Background Color
Java Servlet Change Background Color You can provide an effective way to the web page by changing the background color of the web page. In servlet, you can do this by using javascript. Here, we are going to change the background color
Advertisements
color change
color change  how to change the color in circle using scrollbar
change player dress color
change player dress color  Hai friends, Can we change player dress color using J2ME. Please provide me an code for this. I can able to attain three colors only. Send the code to mail id. vijaikiranit@gmail.com
how to change color of titlebar in java
how to change color of titlebar in java  pls help
change color according to the database value
change color according to the database value  any one know how to get values from database ( 1 or 0 ) and according to that change the color ( red or green) of given list
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
MKMapView Change Red Pin Color
MKMapView Change Red Pin Color  MKMapView Change Pin Color Hi, in my iphone map view application, i displayed the image on annotation instead of custom pin. But however on click it changes to red color pin. Can any one please
Change the color of the selected tab
Change the color of the selected tab Swing provides different methods to give color effects which gives a presentable look to the components. In this section, you will learn how to change the color of the selected tab. For this, we have
change color of back ground using switch
change color of back ground using switch   how to change back ground color according to day using switch case
Change background color of text box - Java Beginners
Change background color of text box  Hi how can i change... while on entering a correct value its background color should change green... problem. Please try the code. Change background Color function
How can I change UIButton title color?
How can I change UIButton title color?  Hi, I have a button in my iPhone/iPad application. I want to change the color of the text when user clicks..., You have to set the color of the button for a particular state say
JavaScript change background color automatically
JavaScript change background color automatically In this section, you will learn how to change the background color of the web page automatically. Now..., we have used using the Math.random(). The window.setTimeout() function change
How to change the color of a base64-encoded png image JQuery?
How to change the color of a base64-encoded png image JQuery?  I am going to change the colors of the pixels of a png image(which is in base64 format.... the original image is shown, but the color does not change. Do you know why
how to change div background color in javascript
how to change div background color in javascript  how to change div background color in javascript ?   <div id="Name">   <div class="content">      <h2>Your Name here</h2>       <p>First
Change Color and Font of text
Change Color and Font of text       This section illustrates you how to change color... to render text and the TextAttribute.FOREGROUND sets the color. The values
change one type of color in between more colors
How to change one type of color in between more colors... to change one type of color in more than one color, It is so easy to make this example... color area to change another color. Color Balance: Now change the color
how to change background color in dojo tab container - Framework
how to change background color in dojo tab container  how to change background color in dojo tab container
how do you change the message box to a specific color
how do you change the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change with each input but i cant give it a specific color. Example I'm trying to change
How to change table row color when click on Hyper Link in jsp?
How to change table row color when click on Hyper Link in jsp?  I use... row2 row3.. when click on the link1 automatically change the the row1 color,similarly when click on the link2 automatically change the the row2
to change the styleclass color of <apex:outputlabel > onclick button function in javascript
to change the styleclass color of onclick button function in javascript ... , then through javascript how can we change the color of outputlabel to red color .my { color: Black; font-size: 10px; font-family: Arial
Change Password - JSP-Servlet
Change Password  Hi all, Please kindly help me with jsp code and explanations to enable me write a change password program. This program will connect to mssql database 2000. Thanks
How to change backgroundcolor and foreground color of JLabel in Java - Java Beginners
How to change backgroundcolor and foreground color of JLabel in Java  How to change backgroundcolor and foreground color of JLabel in Java  Hi Friend, Try the following code: import java.io.*; import java.awt.
change password - JSP-Servlet
change password  hi, my problem is as follows: i am creating a simple web application using mysql and jsp. now i want to create a web page...-varchar] userPassword [data type-varchar] now suppose user wants to change his
UIWebView Background Color
UIWebView Background Color If you wanted to change the background color...). Where as setBackgroundColor will allow you to change the color of background area of UIWebView or UIView. This example illustrate you how to change the color
Change Background color using Custom Tag
Change Background color using Custom Tag In this program, We will create a Custom Tag which changes the background color. JSP Custom Tags : Provide... according to your choice, this background color change is due to the custom tag
Photoshop eye color brown to blue
;    How to change the eye color from brown to blue If you want to change the eye color but you are not able to do that then this tutorial... this. Change color: Go to Image menu > Adjustment > Color Balance and make setting
changing Chunk Color
change the color of chunk color .This example tell you how you can change the color of chunk and how you can add fonts and gives the size of the fonts... changing Chunk Color     
UINavigationBar Color - iPhone example
UINavigationBar Color - iPhone example The example is discussing about how to change the color of UINavigationBar. In iPhone applications you can customize the UINavigationBar and change their color either programmatically or by Interface
UITableView Background Color
UITableView Background Color To change the background color of UITableView...]; The above line will change the default background color into gray color. You can also set the gradient to it. In this example we are simply changing the color
can i change the logo of the web site on the fly - JSP-Servlet
can i change the logo of the web site on the fly  Sir, will you please let me know if i can change the logo of the web site on the fly. What will i have to enable logo changing on the fly. Mine is a web application.Please let me
Color
to create new colors, and predefines a few color constants (see below.... White is (255, 255, 255) and black is (0,0,0). Color Constants Java originally defined a few color constant names in lowercase, which violated
div background color in html
div background color in html   How to change the background color of DIV in HTML
color cycle
color cycle  how do you implement a program for color cycle that has a button such that when i press the button it brings a sequence for example green-red-grey-green e.t.c and should use the getter methods and set methods
UIButton text color
UIButton text color  Hi, I have to change the text color of UIButton to black. Give me best code for changing UIButton text color to black. Thanks
iPhone Switch Changes Toolbar Color
iPhone Switch Changes Toolbar Color In this tutorial we will use Switch button to change the Color of Toolbar. The Switch is added through the Interface... for the action which is declared in .h file, in that will change the color
Change Email
Change Email  Hi, I need to change my Rose India register email address for receive email, How did it possible
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
Changing background color using JavaScript
Changing background color using JavaScript  Hi Sir Is there any way to change the background color using JavaScript ? Please mention code with your... below function to change the background color & call it wherever it needed
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color rectangle around image. how do i change color of that rectangle from brown to white
Jbutton[] background & foregroundcolor change
Jbutton[] background & foregroundcolor change  how to change the color of the selected JButton in java swing. I am create JButton in an array... foreground and background color is changed. the remaining jbutton foreground
Changing the message box to a specific color
Changing the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change with each input but i cant give it a specific color. Example I'm trying to change
password change
password change  Hi , I am using jsf and trying to write a code to change the password of a user . Ihave to retrine userid fromdata base how to do that using session
How to design a changing color of the chameleon, changing color of the chameleon, color of the chameleon
by the Polygonal lasso tool (L key). Effects: Now we have to change the color... How to design a changing color of the chameleon  ... the color, you can see now by this example. Let's see how the chameleon
Get the color values as a matrix of color image
Get the color values as a matrix of color image  I am new to java and image processing, i want to get the color values as a matrix from the color image for giving input to the compression algorithm by using java. plz provide
color changing - Java Beginners
color changing  sir how to change the color of the selected tab in java swing  Hi Friend, Try the following code: import javax.swing.*; import java.awt.*; import javax.swing.event.*; import java.awt.event.
changing Background Color
change background color of a pdf file. You can change the background color...: setBackground(Color color):  If you want to change the background color  then we use this method. This method is used to change the color
Javascript background color - Java Beginners
; Hi Friend, If you want to change the background color of the textbox, try the following code: Change background Color function check...Javascript background color  Hi How to compare background color
Advertisements
 

 

 

DMCA.com