Qibla direction

Developer
Size
2,208 Kb
Views
2,024

How do I make an qibla direction?

What is a qibla direction? How do you make a qibla direction? This script and codes were developed by Khalid Munir on 11 January 2023, Wednesday.

Qibla direction Previews

Qibla direction - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>qibla direction</title>
</head>
<body> <form> <table class="hel12" width="610"> <tbody> <tr> <td>Latitude (Decimal Deg)</td> <td><input type="text" name="Latitude">e.g., 39.4 ["+" North, "-" South)</td> </tr> <tr> <td>Longitude (Decimal Deg)</td> <td><input type="text" name="Longitude">e.g., -107.9 ["+" East, "-" West)</td> </tr> <tr> <td>Qibla from True North =</td> <td><span id="Qibla"></span></td> </tr> <tr> <td colspan="2" align="center"> <input type="button" value="Calculate" onclick="a=calculate(this.form.Latitude.value,this.form.Longitude.value);displayDirection(a);return false;"> &nbsp; <input type="button" value="Clear" onclick="this.form.reset();clearResult();return false"> </td> </tr> </tbody> </table>
</form> <script src="js/index.js"></script>
</body>
</html>

Qibla direction - Script Codes JS Codes

var PI = Math.PI;
var win = null;
function calculate(lat, lon) {	if (isNaN(lat+0.0) || isNaN(lon+0.0)) {	alert("Non-numeric entry/entries");	return "???";	}	if ((lat-0.0)>(90.0-0.0) || (lat-0.0)<(-90.0-0.0)) {	alert("Latitude must be between -90 and 90 degrees");	return "???";	}	if ((lon-0.0)>(180.0-0.0) || (lon-0.0)<(-180.0-0.0)) {	alert("Longitude must be between -180 and 180 degrees");	return "???";	}	if ((lat+0.0==21.4) && (lon+0.0==39.8)) return "Any Direction";	latk = 21.4225*PI/180.0;	longk = 39.8264*PI/180.0;	phi = lat*PI/180.0;	lambda = lon*PI/180.0;	qiblad = 180.0/PI*Math.atan2(Math.sin(longk-lambda), Math.cos(phi)*Math.tan(latk)-Math.sin(phi)*Math.cos(longk-lambda)); console.log(qiblad);	return (qiblad);
}
function clearResult()
{	if (document.getElementById) document.getElementById('Qibla').innerHTML='';	else if(document.all) document.all['Qibla'].innerText='';	else if (win) {	win.close();	win = null;	}
}
function displayDirection(a)
{	d = (a>=0? a+" degrees East of North" : -a+" degrees West of North");	if (document.getElementById) document.getElementById('Qibla').innerHTML = d;	else if (document.all) document.all['Qibla'].innerText = d;	else {	win = open('','Result','width=200,height=75'); win.document.close(); win.document.write('Qibla direction is <br>'+d);	}
}
Qibla direction - Script Codes
Qibla direction - Script Codes
Home Page Home
Developer Khalid Munir
Username khalidmunir
Uploaded January 11, 2023
Rating 3
Size 2,208 Kb
Views 2,024
Do you need developer help for Qibla direction?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Khalid Munir (khalidmunir) Script Codes
Create amazing art & images with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!