Quote:
Originally Posted by ajaynayak7
Hi,
That means It should allow very next and previous checkboxes and other should be readonly.
|
The question still isn't clear, but is this anywhere close?
Code:
<body>
<form id='myForm'>
<input name = "theDay" type = "checkbox" value = "Sunday"> Sunday <br>
<input name = "theDay" type = "checkbox" value = "Monday"> Monday <br>
<input name = "theDay" type = "checkbox" value = "Tuesday"> Tuesday <br>
<input name = "theDay" type = "checkbox" value = "Wednesday"> Wednesday <br>
<input name = "theDay" type = "checkbox" value = "Thursday">Thursday <br>
<input name = "theDay" type = "checkbox" value = "Friday"> Friday<br>
<input name = "theDay" type = "checkbox" value = "Saturday"> Saturday<br>
</form>
<script type = "text/javascript">
(function( boxes )
{
var today = new Date().getDay(),
diff;
for( var i = 0, len = boxes.length; i < len; i++ )
boxes[i].disabled = ( diff = Math.abs( i - today ) ) > 1 && ( diff != len-1 );
})( document.getElementById( 'myForm' ).theDay )
</script>
</body>