মঙ্গলবার, ২৯ মার্চ, ২০১১

jQuery disable / enable SELECT options based on Radio selected

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<title>Sandbox</title>
</head>
<body>
ABC: <input type="radio" name="abc123" id="abc"/>
123: <input type="radio" name="abc123" id="123"/>

<select id="theOptions">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>

</select>
<script>
jQuery.fn.filterOn = function(radio, values) {
return this.each(function() {
var select = this;
var options = [];
$(select).find('option').each(function() {
options.push({value: $(this).val(), text: $(this).text()});
});
$(select).data('options', options);
$(radio).click(function() {
var options = $(select).empty().data('options');
var haystack = values[$(this).attr('id')];
$.each(options, function(i) {
var option = options[i];
if($.inArray(option.value, haystack) !== -1) {
$(select).append(
$('<option>').text(option.text).val(option.value)
);
}
});
});
});
};

$(function() {
$('#theOptions').filterOn('input:radio[name=abc123]', {
'abc': ['a','b','c'],
'123': ['1','2','3']
});
});
</script>
</body>
</html>

courtsey SandBox

সোমবার, ২৮ মার্চ, ২০১১

js confirm block

<script type="text/javascript"><br />function show_confirm()<br />{<br />var r=confirm("Press a button!");<br />return r;<br /><br />}<br /></script>

<a onclick="return show_confirm()" href="http://algobd.com/" value="nothing">click</a>

রবিবার, ২০ মার্চ, ২০১১

Ant as build file

To get up and running with the binary edition of Ant quickly, follow these steps:

  1. Make sure you have a Java environment installed, See System Requirements for details.
  2. Download Ant. See Binary Edition for details.
  3. Uncompress the downloaded file into a directory.
  4. Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH. See Setup for details.
  5. Optionally, from the ANT_HOME directory run ant -f fetch.xml -Ddest=system to get the library dependencies of most of the Ant tasks that require them. If you don't do this, many of the dependent Ant tasks will not be available. See Optional Tasks for details and other options for the -Ddest parameter.
  6. Optionally, add any desired Antlibs. See Ant Libraries for a list.

Note that the links in the list above will give more details about each of the steps, should you need them. Or you can just continue reading the rest of this document.

The short story for working with the Ant source code (not needed if you are working with the binary edition) is:
  1. Get the source code. See Source Edition for details.
  2. Build Ant. See Building Ant for details.

For the full story, continue reading. continue-->