I'm making a website with unchanged header and footer. The main div is changed when one clicks the sites. Here is the code:
<p id="item1">Item 1</p>
...
<script>
$("#item").click(function(){$("#main").load("item1.html");});
</script>
In item1.html:
<div id="sth"></div>
...
<script>
window.onload = function() {document.getElementById("sth").style.width = ...
</script>
Item1.html works fine when I open it separately (url = mywebsite.com/item1.html). But when I start it with the script above (index.html), the window.onload function don't work. How can I fix it?