hac13 hac13 - 5 months ago 10
CSS Question

How are webpages linked?

I'm having trouble figuring out how two pages are linked. For example if I have the following code:

<!DOCTYPE html>
<html>
<button onclick='myfunction()'>Click me</button>
<body>

<script>
function myfunction() {
//some code to take user to the next page
}
</script>

<style>
some style code
</style>


How is the code for the second html file called?

Do all the contents of all webpages reside in one big html file where elements are hidden depending on the what they've clicked on? For example - the
div
's shown on the 'home page' would be shown, while other ones hidden, if you click on a 'home' tab; essentially reformatting the elements on a page for a given file.

Answer

Okay.
1) They're typically on different .html documents, and are usually loaded with <a href="http://location">Link text</a>.
2) You can load a page via javascript by doing document.location = "http://location" as well.