.js script wont open or fire in an external file when using a Math.min() and Math.max() object. Math.min() and Math.max()
Math.min() and Math.max() can be used to find the lowest or highest value in a list of arguments:
<html>
<body>
function myFunction() {
document.getElementById("demo").innerHTML =
Math.min(0, 150, 30, 20, -8, -200);
}
</script>
</body>
</html>
I split up the script and used
function myFunction() {
document.getElementById("demo").innerHTML =
Math.min(0, 150, 30, 20, -8, -200);
}
in the .js file exactly as seen above no <script> was included and it didn't work, or fire. Yes I placed the first part in an html file calling the .js file like this:
<html>
<body>
</body>
</html>
Now I have successfully include various js files without a hitch but any Math objects or math methods don't appear to be able to work, I am running IE11. But it doesn't work on google browsers either. I even successfully fired a transitional script a red square that moves diagonally down screen, so what can I try. Also I have conbined scripts, here is how it looks from the Html script:
<html>
#container {
width: 400px;
height: 400px;
;
background: yellow;
}
#animate {
width: 50px;
height: 50px;
;
background-color: red;
}
</style>
<body>
<button onclick="myMove()">Click Me</button>
</p>
<div id ="animate"></div>
</div>
<head>
<script src="redrectangle.js">
</script>
</head>
<body>
<input type="button" onclick="popup()" value="Click this!">
</body>
<head>
</script>
</head>
<p>Infinity is returned if you calculate a number outside the largest possible number.</p>
<button onclick="myFunction1()">Try it</button><p id="demo"></p>
<script src="redrectangle.js">
</script>
</head>
</head><body>
Enter your name: <input type="text" onfocus="myFunction(this)">
<p>When the input field gets focus, a function is triggered which changes the background-color.</p> </body>
<body>
</body>
<html>
this is on the .js script:
function myMove() {
var elem = document.getElementById("animate");
var pos = 0;
var id = setInterval(frame, 5);
function frame() {
if (pos == 350) {
clearInterval(id);
} else {
pos++;
elem.style.top = pos + 'px';
elem.style.left = pos + 'px';
}
}
}
alert("Hello World")
}
x.style.background = "yellow";
}
document.getElementById("demo") =
Math.min(0, 150, 30, 20, -8, -200);
}
so any takers out there that can provide an answer I seem to be stumped.