Friday 14 October 2011

Why do I receive an "Operation aborted" error message when I visit a Web page in Internet Explorer?

This problem occurs because a child container HTML element contains script that tries to modify the parent container element of the child container. The script tries to modify the parent container element by using either the innerHTML method or the appendChild method.

For example, this problem may occur if a DIV element is a child container in a BODY element, and a SCRIPT block in the DIV element tries to modify the BODY element that is a parent container for the DIV element.

http://support.microsoft.com/kb/927917

Friday 7 October 2011

Calculate last date of given month using JavaScript

<html>
<body>
The end date of this month is
<script type="text/javascript">


//Today
var d = new Date();

//var d = new Date(2011, 10, 1);
//alert(d);

//End date of this month
var d = new Date(d.getFullYear(), d.getMonth() + 1, 0);

//alert(d);

var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December' ];
var endDate = d.getDate() + ' ' + monthNames[d.getMonth()] + ' ' + d.getFullYear();

//alert(endDate);

document.getElementById('prizeDrawEndDate').innerHTML = endDate;

</script>




Click here to try it by copying the script into w3schools try it editor