My javascript is running before my HTML loads, even if I put it right before the like this:
<body>
<h1>Title</h1>
<script>
alert("yo");
</script>
</body>
Any ideas why that may be happening?
My javascript is running before my HTML loads, even if I put it right before the like this:
<body>
<h1>Title</h1>
<script>
alert("yo");
</script>
</body>
Any ideas why that may be happening?
Say I have a switch statement that takes a variable myData between 1 and some larger value, i.e. 300.
Depending on the "status code" variable, the result is the text value of another variable. For example, if myData == 1, I want to return the a variable called code1. If myData == 300, I want to return the a variable called code300. Code1 and code300 variables store unrelated strings, i.e. "This is a summary", or "This is a note". Some psuedo-code below:
var myData = statusCode;
var code1 = "This is a summary";
var code300 = "This is a note";
switch(myData) {
case statusCode:
scriptletResult = returnCode("code", statusCode); // code1 if myData == 1
break;
default:
scriptletResult = code1;
}
function returnCode(code, statusCode) {
return code + statusCode; // Returns a variable "code1" if statusCode == 1
}
How can I get this to work?
JavaScript
Now, JavaScript
read full article here
Features of the JS language The main features of this programming language are: Dynamic typing. That is, the data type will only be determi...