Newbie question below, this is my first html thing
I'm trying to show the default parameters (values of the object tools.IBParams) of input text elements in the page when the first button is pressed. The default parameters come from another js file named tools.js. This is not working. Why?
Code below:
<!DOCTYPE html>
<html>
<head>
<title>Change parameters</title>
</head>
<body>
<div align="center">
<form action="/change_params.html" method="get">
<fieldset>
<legend>Enter the parameters values to modify and press Submit Data:</legend>
<p>
<button onclick="seeValues()">SHOW ACTUAL VALUES</button>
</p>
<p>
Primary refrigerant specific Heat (SI) <br>
<input type="text" id="spec_heat" value="">
</p>
<p>
Primary refrigerant density (SI) <br>
<input type="text" id="density" value="">
</p>
<p>
Charge level limit (mm) <br>
<input type="text" id="chargeLevLim" value="">
</p>
<p>
Discharge level limit (mm) <br>
<input type="text" id="dischargeLevLim" value="">
</p>
<p>
Charge temperature limit (degC) <br>
<input type="text" id="chargeTempLim" value="">
</p>
<p>
Discharge temperature limit (degC) <br>
<input type="text" id="dischargeTempLim" value="">
</p>
<p>
Derivative limit (mm/s) <br>
<input type="text" id="derivLim" value="">
</p>
<p>
Power high limit (SI) <br>
<input type="text" id="powerHighLim" value="">
</p>
<p>
Power low limit (SI) <br>
<input type="text" id="powerLowLim" value="">
</p>
<p>
Flow high limit (lpm) <br>
<input type="text" id="flowHighLim" value="">
</p>
<p>
Flow low limit (lpm) <br>
<input type="text" id="flowLowLim" value="">
</p>
<p>
Time interval for data retrieval (secs) <br>
<input type="text" id="sendPeriod" value="">
</p>
<input type="submit" value="Submit Data" onclick="window.location.reload()">
</fieldset>
</form>
</div>
<script>
var tools = require('./tools');
function seeValues () {
for (key in tools.IBParams) {
document.getElementById(key).value = tools.IBParams[key];
console.log("\n\nPASSED HERE\n\n");
}
}
</script>
</body>
</html>