<!DOCTYPE html>
<html>
<!-- astro.js : http://slowe.github.io/astro.js/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
</style>
<script language="javascript" type="text/javascript" src="astro.js/astro.js"></script>
<script language="javascript" type="text/javascript" src="astro.js/astro.dates.js"></script> <!-- JD, GST, LST -->
<script language="javascript" type="text/javascript" src="astro.js/astro.ephem.js"></script> <!-- sunPos, moonPos -->
<script language="javascript" type="text/javascript" src="astro.js/astro.coords.js"></script> <!-- coordinates and value transformation -->
<script language="javascript" type="text/javascript" src="astro.js/astro.coordinates.js"></script> <!-- coordinates and value transformation -->
<script language="javascript" type="text/javascript">
var lng = 48.12;
var lat = -16.32;
var tz = -1;
function initAstro() {
//astrojs.ready(function(e){ });
// ...
doAstro();
return;
}
function doAstro() {
var txt = "";
var dt = new Date();
txt += dt + "<br>\n";
var jd = astrojs.dates.getJulianDate(dt);
txt += "Julian Date (JD) : " + jd + "<br>\n";
txt += "Greenwich Sidereal Time (GST) : " + astrojs.dates.getGST(dt) + "<br>\n";
var lst = astrojs.dates.getLST(dt, lng);
txt += "Local Sidereal Time (LST) : " + lst + "<br>\n";
var sunpos = astrojs.ephem.sunPos(jd);
txt += "Sun Pos : lat:" + sunpos.lat + " lon:" + sunpos.lon + " Mo:" + sunpos.Mo +
" D:" + sunpos.D + " N:" + sunpos.N + "<br>\n";
var sunazel = astrojs.coordinates.ecliptic2azel(sunpos.lat, sunpos.lon, lst, lat); // <<<< ERROR
txt += "Sun Pos : az:" + sunazel.az + " el:" + sunazel.el + "<br>\n";
var moonpos = astrojs.ephem.moonPos(jd, sunpos);
txt += "Moon Pos : lat:" + moonpos.lat + " lon:" + moonpos.lon + "<br>\n";
txt += "mean Obliquity : " + astrojs.coordinates.meanObliquity(jd) + "<br>\n";
document.getElementById("output").innerHTML = txt;
return;
}
</script>
</head>
<body onload="initAstro()">
<form name="astro" action="#" onsubmit="doAstro();">
<button onclick="doAstro();">submit</button>
</form>
<br><br>
Result:<br>
<p id="output">*</p>
</body>
</html>