I'm building a site using Joomla 3.3.1, and I'd like an alert box to pop up whenever users first visit the site (and not pop up on subsequent page clicks or when refreshing the page). The alert box should say "By visiting this page, you agree to its Terms of Service" with "Terms of Service" being a link to a specific page. And users can click OK. I'm very new to JavaScript, but I tried the code below:
<script>
function TOS(){
alert("By visiting this page, you agree to its Terms of Service.");
}
TOS();
</script>
Unsurprisingly, this made the alert pop up anytime I clicked on anything on the page. I also tried calling the function in the with onload, but I got similar results.
Any guidance or references you can provide would be much appreciated!