Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1

Thread: Error Checking

  1. #1
    Regular Coder MrEnder's Avatar
    Join Date
    Jul 2008
    Location
    Canada Ontario
    Posts
    258
    Thanks
    18
    Thanked 4 Times in 4 Posts

    Error Checking

    I made a cool calendar application I want someone to look over it and see if I messed up anywhere cause I have a good feeling I did. It was designed to be an active desktop ^.^ that way I get my desktop image and a calendar ^.^

    index.html

    Code:
    <html>
    <head>
    
    <title>Desktop</title>
    
    <link rel="stylesheet" type="text/css" href="css/mainTemplate.css" />
    
    </head>
    <body>
    
    <img id="bgImage" src="images/nerbian-entrance.jpg" alt="Active Desktop made by Shelby Brittain" />
    
    <table id="mainTable">
    	<caption id="caption">&nbsp;</caption>
    	<tr>
    		<th>
    			Sunday
    		</th>
    		<th>
    			Monday
    		</th>
    		<th>
    			Tuesday
    		</th>
    		<th>
    			Wednesday
    		</th>
    		<th>
    			Thursday
    		</th>
    		<th>
    			Friday
    		</th>
    		<th>
    			Saturday
    		</th>
    	</tr>
    	<tr>
    		<td id="d1">
    			&nbsp;
    		</td>
    		<td id="d2">
    			&nbsp;
    		</td>
    		<td id="d3">
    			&nbsp;
    		</td>
    		<td id="d4">
    			&nbsp;
    		</td>
    		<td id="d5">
    			&nbsp;
    		</td>
    		<td id="d6">
    			&nbsp;
    		</td>
    		<td id="d7">
    			&nbsp;
    		</td>
    	</tr>
    	<tr>
    		<td id="d8">
    			&nbsp;
    		</td>
    		<td id="d9">
    			&nbsp;
    		</td>
    		<td id="d10">
    			&nbsp;
    		</td>
    		<td id="d11">
    			&nbsp;
    		</td>
    		<td id="d12">
    			&nbsp;
    		</td>
    		<td id="d13">
    			&nbsp;
    		</td>
    		<td id="d14">
    			&nbsp;
    		</td>
    	</tr>
    	<tr>
    		<td id="d15">
    			&nbsp;
    		</td>
    		<td id="d16">
    			&nbsp;
    		</td>
    		<td id="d17">
    			&nbsp;
    		</td>
    		<td id="d18">
    			&nbsp;
    		</td>
    		<td id="d19">
    			&nbsp;
    		</td>
    		<td id="d20">
    			&nbsp;
    		</td>
    		<td id="d21">
    			&nbsp;
    		</td>
    	</tr>
    	<tr>
    		<td id="d22">
    			&nbsp;
    		</td>
    		<td id="d23">
    			&nbsp;
    		</td>
    		<td id="d24">
    			&nbsp;
    		</td>
    		<td id="d25">
    			&nbsp;
    		</td>
    		<td id="d26">
    			&nbsp;
    		</td>
    		<td id="d27">
    			&nbsp;
    		</td>
    		<td id="d28">
    			&nbsp;
    		</td>
    	</tr>
    	<tr>
    		<td id="d29">
    			&nbsp;
    		</td>
    		<td id="d30">
    			&nbsp;
    		</td>
    		<td id="d31">
    			&nbsp;
    		</td>
    		<td id="d32">
    			&nbsp;
    		</td>
    		<td id="d33">
    			&nbsp;
    		</td>
    		<td id="d34">
    			&nbsp;
    		</td>
    		<td id="d35">
    			&nbsp;
    		</td>
    	</tr>
    		<tr>
    		<td id="d36">
    			&nbsp;
    		</td>
    		<td id="d37">
    			&nbsp;
    		</td>
    		<td id="d38">
    			&nbsp;
    		</td>
    		<td id="d39">
    			&nbsp;
    		</td>
    		<td id="d40">
    			&nbsp;
    		</td>
    		<td id="d41">
    			&nbsp;
    		</td>
    		<td id="d42">
    			&nbsp;
    		</td>
    	</tr>
    </table>
    </div>
    
    <script type="text/javascript" src="js/mainLib.js">
    //<![CDATA[
    
    //]]>
    </script>
    
    </body>
    </html>
    css/mainTemplate.css

    Code:
    body {
    
    	background-color: black;
    	color: #C0C0FF;
    
    }
    caption {
    
    	font-size: 24pt;
    
    }
    th, td {
    	
    	width: 100px;
    	border: 1px solid #C0C0FF;
    
    }
    th {
    
    	height: 25px;
    
    }
    td {
    
    	vertical-align: bottom;
    	text-align: right;
    
    }
    #bgImage {
    
    	position: absolute;
    	top: 0px;
    	left: 0px;
    	width: 102%;
    	height: 103%;
    
    }
    #mainTable { 
    
    	position: absolute;
    	top: 2%;
    	left: 61%;
    	border: 1px solid #C0C0FF;
    	padding: 5px;
    	vertical-align: top;
    	width: 600px;
    	height: 375px;
    	background-color: black;
    	opacity:0.5;
    	filter:alpha(opacity=50);
    
    }
    js/mainLib.js

    Code:
    var d = new Date();
    var day = d.getDate();
    var wk = d.getDay();
    var set = new Array(35);
    var j = 0;
    var mnth = d.getMonth();
    
    
    function getMonthName() {
    	
    	var mth = "";
    	
    	var month = new Array(12);
    	month[0]="January";
    	month[1]="Febuary";
    	month[2]="March";
    	month[3]="April";
    	month[4]="May";
    	month[5]="June";
    	month[6]="July";
    	month[7]="August";
    	month[8]="September";
    	month[9]="October";
    	month[10]="November";
    	month[11]="December";
    	
    	mth = month[d.getMonth()];
    
    	return mth;
    	
    }
    
    function getFirstDay() {
    
    	var firstDay = wk;
    	
    	for(var i=day-1; i>=0; i--) {
    		firstDay--;
    		if(firstDay == -1) {
    		
    			firstDay=6;
    		
    		}
    	
    	}
    	
    	return firstDay;
    
    }
    
    if(mnth==1 && getFirstDay()!=6) {
    
    	monthLength = 28;
    
    }
    else if(mnth==1 && getFirstDay()==6) {
    
    	monthLength = 28+6;
    
    }
    else if(mnth==0 || mnth==3 || mnth==5 || mnth==8 || mnth==10) {
    
    	monthLength = 30+getFirstDay();
    
    }
    else {
    
    	monthLength = 31+getFirstDay();
    
    }
    
    document.getElementById("caption").innerHTML = getMonthName();
    if(getFirstDay()==6) {
    
    	for(var i=1; i<=monthLength-6; i++) {
    		
    		j++;
    		set[i] = "d"+ (i);
    		document.getElementById(set[i]).innerHTML = j;
    		
    	}
    
    }
    else {
    	for(var i=getFirstDay()+1; i<=monthLength; i++) {
    		
    		j++;
    		set[i] = "d"+ (i + 1);
    		document.getElementById(set[i]).innerHTML = j;
    		
    	}
    }
    Thanks
    Shelby
    Last edited by MrEnder; 02-20-2010 at 06:25 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •