I'm not sure if I understood your question correctly, @Carlos, if you happen to speak spanish then we could try that way. But anyways, this is what I understood:
- You have 2 html files: One called "a.html" and the other one, let's call it "b.html"
- The "a.html" file has inline JavaScript in it, this means, it's using the <script> tag with all the logic and scripting statements inside the opening and closing script tags, like this, for example:
<script>
document.write("Hello World");
</script>
- The "b.html" file, however, it's using the <script> tag to reference an external script, but basically you want to know if you can "call" the inline JavaScript from another html file, in this case, the scripting statement that's inside the script tags from the "a.html" file. Like this, your example:
<script src="a.html">
If this was your question. Then the answer is no.
Why? 3 reasons:
1) The inline JavaScript is considered a bad practice. So, try to avoid it, in this case the "a.html" file should NOT contain a client-side script (JavaScript) written inline, but rather, it should point to an external script file through the src attribute. Remember, an html file is not a script file because its extension is ".html" which tells the browser that what's inside that file is a "hypertext markup language", a real script file has the ".js" extension.
2) If you want to run the same JavaScript statements on both pages, I mean, on "a.html" and "b.html" files, then, you should create an external JavaScript file (save it with the ".js" extension), instead of writing the same script over and over again, and then refer to it using the src attribute in the <script> tag of both a and b html pages.
3) An external script file CANNOT contain the <script> tag. So in your case, if you wanted to use the "a.html" page as the external script you couldn't do it mainly because of the previous reasons given but also because external scripts cannot contain the html <script> tag, which "a.html" is using.