U
user12
Member
- Beiträge
- 5
- Punkte Reaktionen
- 0
when ever i try to bind my javaScript code to my html code content from my page is missing that happing when i bind my javaScript cod in the top of my html code , but if i bind it on the bottom before the 2 line of my html code i get no error and every things works just fine, but i dont want that bc it is bad practice! can anyone tell me where is the problem, and why binding my html code in the top is probmle which what should be the right way to do it.
<!DOCTYPE html>
<html>
<!-- Rui Santos - Complete project details at https://RandomNerdTutorials.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. -->
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type='text/javascript' src="app.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body onload="set_ButtonState()">
<div class="div__p__motor"> Motor Status</div>
<div class="motor_pos__div">
<div class="motor__div">
<h3>Aus / AN <span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" name="motor_on_off" onchange="toggleCheckbox(this)" id="motor_on_off" " +
outputStateValue + ">
<span class="slider"></span>
</label>
</div>
<div class="interval__div">
<h3>Interval <span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" name="motor_mix" onchange="toggleCheckbox(this)" id="motor_interval" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
<div class="mix__div">
<h3>Mix<span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" onchange="toggleCheckbox(this)" id="motor_mix" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
</div>
<div class="temp__sttings">
<input
class="temp__slider"
type="range"
id="myRange"
value="20"
onchange="myFunction(this.value)"
/>
<div class="temperature__p"> Motor = </div>
<div class="temp__slider__p" id="demo"> 1</p></div>
</div>
<div class="div__p__temprature">Temprature</div>
<div class="temp__div">
<div class="mix__div">
<h3>AN/AUS<span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" onchange="toggleCheckbox(this)" id="output_temp" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
</div>
<div class="temp__sttings">
<input
class="temp__slider"
type="range"
id="myRange2"
value="20"
onchange="myFunction2(this.value)"
/>
<div class="temperature__p"> ℃ </div>
<div class="temp__slider__p" id="demo2"> 1</p></div>
</div>
<!--- Diagramm-->
<div id="chart-temperature" class="container"></div>
<div id="chart-Motor" class="container"></div>
<!-- <div id="chart-pressure" class="container"></div> -->
</body>
</html>
<!DOCTYPE html>
<html>
<!-- Rui Santos - Complete project details at https://RandomNerdTutorials.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. -->
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type='text/javascript' src="app.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body onload="set_ButtonState()">
<div class="div__p__motor"> Motor Status</div>
<div class="motor_pos__div">
<div class="motor__div">
<h3>Aus / AN <span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" name="motor_on_off" onchange="toggleCheckbox(this)" id="motor_on_off" " +
outputStateValue + ">
<span class="slider"></span>
</label>
</div>
<div class="interval__div">
<h3>Interval <span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" name="motor_mix" onchange="toggleCheckbox(this)" id="motor_interval" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
<div class="mix__div">
<h3>Mix<span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" onchange="toggleCheckbox(this)" id="motor_mix" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
</div>
<div class="temp__sttings">
<input
class="temp__slider"
type="range"
id="myRange"
value="20"
onchange="myFunction(this.value)"
/>
<div class="temperature__p"> Motor = </div>
<div class="temp__slider__p" id="demo"> 1</p></div>
</div>
<div class="div__p__temprature">Temprature</div>
<div class="temp__div">
<div class="mix__div">
<h3>AN/AUS<span id="outputState"></span></h3>
<label class="switch">
<input type="checkbox" onchange="toggleCheckbox(this)" id="output_temp" " +
outputStateValue + ">
<span class="slider"> </span>
</label>
</div>
</div>
<div class="temp__sttings">
<input
class="temp__slider"
type="range"
id="myRange2"
value="20"
onchange="myFunction2(this.value)"
/>
<div class="temperature__p"> ℃ </div>
<div class="temp__slider__p" id="demo2"> 1</p></div>
</div>
<!--- Diagramm-->
<div id="chart-temperature" class="container"></div>
<div id="chart-Motor" class="container"></div>
<!-- <div id="chart-pressure" class="container"></div> -->
</body>
</html>