JSP Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Scripts
JSP scripts List All
News Ticker News Ticker
Rating Script Free Rating
Ad Banner Ad Banner
Image Rotator Image Rotator
DBQ Tool DBQ Tool
Visitor Tracking Visitor Tracking
Browser Stats Browser Stats
Guest Book Guest Book
Calendar Free Calendar
Chat Box Chat Box
Captcha Image Captcha Image
Form Mailer Form Mailer
Free Counter Free Counter
Random Text Generator Random Text Generator
 




Calendar JSP Script


About
Calendar script is used to get monthly calendar in website. It has been tested to work in browsers like mozilla, IE, opera.


Features
a) This free monthly Calendar can be displayed in any webpage.
b) Has previous, next option that can span to any month of a year.
c) The colors and size can be modifed easily to suit your website.
d) Very simple and easy to use.

Preview


Code
<%@ page import="java.util.Calendar"%>
<%
	String bgcolor = "#232323";
	String tablecolor = "#104881";
	String fontcolor = "#c9c9c9";
	String tableborder = "#446655";

	Calendar cal = Calendar.getInstance();
	int year  = cal.get(Calendar.YEAR);
	int month = cal.get(Calendar.MONTH);
	String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
%>
<script type="text/javascript">
function ctck()
{
    var sds = document.getElementById("dum");
    if(sds == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
    }
    var sdss = document.getElementById("dumdiv");
    if(sdss == null){
        alert("You are using a free package.\n You are not allowed to remove the tag.\n");
    }
}
document.onload="ctck()";
</script>
<table style='border: 2px solid rgb(0, 0, 0);color:446655;' bgcolor='<%= bgcolor%>' cellspacing=1 height=150 width=250>
	<tr width="250" height="30">
	<td style='border-bottom: 0px solid rgb(255, 255, 255);' align=center width=245>
	<font color='<%= fontcolor%>'><b><%= months[month]+' , '+year %></b></font></td>
	<td style='border-bottom: 0px solid rgb(255, 255, 255);' align=center width=5>
	</td>
	</tr>
	<tr width=250 height=100>
	<td colspan=2 height=100 width=250>
		<table color=446655 bgcolor=<%= bgcolor %> border=0 cellpadding=0 cellspacing=1 height=100 width=250>
	        <tr align=center bgcolor=#505050>
		<td><font size=-1><b>Sun</b></font></td>
                <td><font size=-1><b>Mon</b></font></td><td><font size=-1><b>Tue</b></font></td>
		<td><font size=-1><b>Wed<b></font></td><td><font size=-1><b>Thu</b></font></td><td><font size=-1><b>Fri</b></font></td><td><font size=-1><b>Sat</b></font></td>
		</tr>
<%!
	public String startRow(String color) {
		return "<tr bgcolor=\""+color+"\">";
	}

	public String createElement(int x, String color) {
		if(x==0) {
			return "<td></td>";
		} else {
			return "<td align=\"center\"><font color=\""+color+"\" size=\"-1\"><b>"+x+"</b></font></td>";
		}
	}

	public String createElement(int x,String color, int bg) {
		return "<td align=\"center\" bgcolor=\"#001100\" ><font color=\""+color+"\">"+x+"</font></td>";
	}
	public String endRow() {
		return "</tr>";
	}
%>
<%	
	int day_of_month = cal.get(Calendar.DAY_OF_MONTH);
	int start = day_of_month;

	if(day_of_month  > 1)
		cal.set(Calendar.DAY_OF_MONTH,  1);
		
	out.println(startRow(tablecolor));
	
	int dow = cal.get(Calendar.DAY_OF_WEEK);

	int i=1;
	for(;i<dow;i++) {
		out.println(createElement(0,fontcolor));
	}
	

	while(cal.get(Calendar.MONTH) == month) {
		day_of_month = cal.get(Calendar.DAY_OF_MONTH);
		dow = cal.get(Calendar.DAY_OF_WEEK);

		if((dow == 1) && (day_of_month !=1))
			out.println(startRow(tablecolor));		
		if(day_of_month==start)
			out.println(createElement(day_of_month,fontcolor,1));
		else 
			out.println(createElement(day_of_month,fontcolor));

		if(dow == 7)
			out.println(endRow());

		cal.add(Calendar.DAY_OF_MONTH, 1);
	}
	dow = cal.get(Calendar.DAY_OF_WEEK);
	if(dow==1) {
		out.println(endRow());
	} else {
		for(i=dow;i<=7;i++) {
			out.println(createElement(0,fontcolor));
		}
		out.println(endRow());
	}

%>
	<table>
	</td>
	</tr>
        </table>
        <div align=center style="font-size: 10px;color: #dadada;" id="dumdiv">
        <a href="http://www.hscripts.com" id="dum" style='text-decoration:none;color: #dadada;'>©H</a></div>


Release Date -12-02-2010
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
a) Just copy the above code and make use of this script in the website.
b) Colors of the calendar can be changed by editing the variables in the file.



License
- The JSP (Java Servlets) script download is given under GPL License
- i.e. Free use for those who use it, as it is.
- Free, if your modification does not remove our copyright information and links.
- For Detailed License information Click Here
- You can purchase the script if your requirements doesn't meet GPL License terms.
Other Links

web hosting