See following code
<div id="news-ticker">
<marquee id="news-marquee" scrollamount="3" onmouseover="stop()" onmouseout="start()" style="padding-top:2px; padding-bottom:2px;">
Latest News
</marquee>
</div>
<script type="text/javascript">
var currenturl = document.URL;
if ((currenturl.indexOf("&lang=nl") != -1) || (currenturl.indexOf(";lang=nl") != -1) || (currenturl.indexOf("&lang=nl#content") != -1)) {
document.getElementById("news-marquee").innerHTML = '<?php require_once("news_nl.php"); ?>';
}
else if ((currenturl.indexOf("&lang=en") != -1) || (currenturl.indexOf(";lang=en") != -1) || (currenturl.indexOf("&lang=en#content") != -1)) {
document.getElementById("news-marquee").innerHTML = '<?php require_once("news_en.php"); ?>';
}
else if ((currenturl.indexOf("&lang=fr") != -1) || (currenturl.indexOf(";lang=fr") != -1) || (currenturl.indexOf("&lang=fr#content") != -1)) {
document.getElementById("news-marquee").innerHTML = '<?php require_once("news_fr.php"); ?>';
}
else {
document.getElementById("news-marquee").innerHTML = '<?php require_once("news_nl.php"); ?>';
}
</script>
On a HTML page, I have a div that contains a marquee to display the latest news on the webpage. The contents that need to be displayed in the marquee are taken from a php file. Here's what's happening:
When the page loads, I first see "Latest News" appearing in the marquee. That is to say: It displays shortly before the javascript gets executed. After that, the news-marquee shows the correct content: If I'm on the Dutch (&lang=nl) part of the website, the Dutch news items are shown, the French items are shown on the French site etc. So that works.
But some pages don't have the "&lang=xx" trail on the URL, so in those cases I have the else condition which displays the Dutch news items by default. This however, does not get executed. The news-marquee stays blank. Not even "Latest News" is shown anymore.
Firebug doesn't throw any errors at me, so I have no idea what could be going on here.