I'm a beginner with HTML-CSS-JS and I have this problem :
When I'm at page1.html of my website, I can sort the different article of the page by selecting a sub-menu of my navigation bar (for example sub-menu 1 is "sport" and when I click on it only the article tagged as "sport" are visible). Here is the function :
<script style="text/javascript">
<!--
function sortNews(id){
var elmt = document.getElementsByTagName("section");
for(var i = 0; i<elmt.length; i++){
if(id == "all")
elmt[i].style.display = "block";
else if(elmt[i].className != id)
elmt[i].style.display = "none";
else
elmt[i].style.display = "block";
}
}
// -->
</script>
When I am at page2.html I can also select the submenu of page 1 via the navigation bar (it means when my mouse go over the menu "news" the sub-menu appear and I can click directly on "Sport"). My question is : can I load the page1.html AND run the function above without another click of the user ? (So the page of news with only the "sport" article will be loaded)
Thank you in advance ! Best regards