Assuming ipwajax('enabletorch')
enables the LED, and ipwajax('disabletorch')
disables it, you would want something like
<script language="JavaScript">
function enableTorch(milliSeconds) {
ipwajax('enabletorch');
window.setTimeout("ipwajax('disabletorch');",milliSeconds);
}
</script>
<input type="button" onclick="enableTorch(3000);" value="Turn on LED">