Sunday, August 05, 2007

prototype javascript library try.these example


<script type="text/javascript" charset="utf-8">
function doc (argument) {
document.write(argument);
document.write("<br />\n");
}
var rs = Try.these(
function() {return new XMLHttpRequest()},
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
);
doc(rs);

var lambda = function() {return new ActiveXObject('Msxml2.XMLHTTP')};
try {
lambda();
} catch (e) {
doc(e);
}
</script>

No comments :