Wizibon
December 19, 2024, 10:39am
1
Thus is my code:
<!--The better your JS is, the better your HTML will look like-->
<!--JS is supreme. I luuuuuv JS. And I'd love to watch Bourne Supremacy-->
<!--I luv JS-->
<html lang="sv-en">
<head>
<meta charset=UTF-8"> <!--mb4-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>alascae.com</title>
<style>
.bold {
font-weight: bold;
}
</style>
<link rel="stylesheet" href='css/_sheldon/_supper.css'>
</head>
<body>
<button></button>
</body>
<script src="js/_inflammable.js"></script>
</html>
I want the _inflammable.js to “JUMP OVER” </body>
tag
What do you mean when you say “jump over”?
Wizibon
December 19, 2024, 10:41am
3
I mean that, if the script would’ve been exactly after button
, I’d just need to write the escape sequence in the inflammable file. But now I have </body>
BEFORE the button
Wizibon
December 19, 2024, 10:43am
4
If the code is gonna follow the escape sequence, then </body>
MUST BE INCLUDED IN THE INFLAMMABLE FILE
Not really, this is just a a path to the file.
Wizibon
December 19, 2024, 11:24am
6
For example, I can’t just write document.getElementsByTagName('button').innerHTML = "My first JS!"
;
I need something BEFORE document that explains "Hey, there is a </body>
tag here.
ILM
December 19, 2024, 11:36am
7
I am not sure I understand what you are asking for
the usual place for the <script>
tag is right before </body>
1 Like
Wizibon
December 19, 2024, 11:50am
8
Yea, but I want all of my JS-scripts to be between </body>
and </html>
ILM
December 19, 2024, 2:21pm
9
all your JavaScript will go in the js/_inflammable.js
file, or not?
anyway, putting the script right above </body>
is the usual way. Do as you want…
still </body>
is html, it can’t go in a *.js
file
Wizibon
December 19, 2024, 9:00pm
10
As you can see, this doesn’t do anything because the </body>
tag is not included.
document.getElementsByTagName('button').innerHTML = "My first Js!";
HTM-file:
<!--The better your JS is, the better your HTML will look like-->
<!--JS is supreme. I luuuuuv JS. And I'd love to watch Bourne Supremacy-->
<!--I luv JS-->
<html lang="sv-en">
<head>
<meta charset=UTF-8"> <!--mb4-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>alascae.com</title>
<style>
.bold {
font-weight: bold;
}
</style>
<link rel="stylesheet" href='css/_sheldon/_supper.css'>
</head>
<body>
<button></button>
</body>
<script src="js/._inflammable.js"></script>
</html>
ILM
December 19, 2024, 9:02pm
11
wrong
getElementsbyTagName
returns an array-like data structure, you need to select an element from that with bracket notation
this giving for good that your file structure is correct
doing that change, it works
(I used it in the browser console)