Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>태양광 이격거리 구하기</title>
</head>
<body>
	<h1>태양광 이격거리 구하기</h1>
	<form>
		<label>모듈길이:</label>
		<input type="number" id="moduleLength" name="moduleLength"><br>

		<label>단수:</label>
		<input type="number" id="numberOfModules" name="numberOfModules"><br>

		<label>모듈 간 이격거리:</label>
		<input type="number" id="moduleSpacing" name="moduleSpacing"><br>

		<label>모듈의 경사각:</label>
		<input type="number" id="moduleAngle" name="moduleAngle"><br>

		<label>태양의 고도각:</label>
		<input type="number" id="solarAltitude" name="solarAltitude"><br>

		<label>지표면의 경사각:</label>
		<input type="number" id="surfaceAngle" name="surfaceAngle"><br>

		<button type="button" onclick="calculate()">계산하기</button>
    <p>이격거리: <span id="result"></span></p>
	</form>

	

	<script src="script.js"></script>
</body>
</html>

              
            
!

CSS

              
                body {
  font-family: Arial, sans-serif;
}

h1 {
  text-align: center;
  margin-top: 50px;
}

form {
  width: 50%;
  margin: 0 auto;
  text-align: center;
}

label {
  display: inline-block;
  width: 150px;
  margin-bottom: 10px;
}

input[type="number"] {
  width: 200px;
  padding: 5px;
  border-radius: 5px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
}

button[type="button"] {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

button[type="button"]:hover {
  background-color: #3e8e41;
}

#result {
  font-weight: bold;
}

              
            
!

JS

              
                function calculate() {
  var moduleLength = parseFloat(document.getElementById("moduleLength").value);
  var numberOfModules = parseFloat(document.getElementById("numberOfModules").value);
  var moduleSpacing = parseFloat(document.getElementById("moduleSpacing").value);
  var moduleAngle = parseFloat(document.getElementById("moduleAngle").value);
  var solarAltitude = parseFloat(document.getElementById("solarAltitude").value);
  var surfaceAngle = parseFloat(document.getElementById("surfaceAngle").value);

  var spacing = moduleSpacing * (numberOfModules - 1);
  if(spacing <= 0) {
    spacing = 0;
  }

  var distance = (moduleLength * numberOfModules + spacing) *
    (Math.sin(Math.PI / 180 * (180 - moduleAngle - solarAltitude)) /
      Math.sin(Math.PI / 180 * (solarAltitude + surfaceAngle)));

  document.getElementById("result").innerHTML = "(" + moduleLength + ", " + numberOfModules + ", " + moduleSpacing + ", " + moduleAngle + ", " + solarAltitude + ", " + surfaceAngle + "): " + distance.toFixed(2)+ "m";


}

              
            
!
999px

Console