samballado
01-20-2011, 12:56 AM
I am trying to get two different sets of content to display on a webpage based on time and day. I am using the following code and can't seem to get it to work. Any suggestions would be welcome.
Thank you.
<!-- Script for Rotation of Library Help and Qwidget -->
<script type="text/javascript">
var checkTime = new Date();
var hours = checkTime.getHours();
var day = checkTime.getDay();
if (day == 0)
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else if ((day > 1 && day < 5) && (hours < 9 && hours > 21))
{
document.getElementById("qpchatwidget").style.display = 'none';
document.getElementById("libraryhelp").style.display = '';
}
else if ((day == 5) && (hours < 9 && hours > 17))
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else if ((day == 6) && (hours < 10 && hours > 16))
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else {
document.getElementById("qpchatwidget").style.display = '';
document.getElementById("libraryhelp").style.display = 'none';
}
</script>
<!-- Beginning of LibraryH3lp code. -->
<div id="libraryhelp" style="display: none;">
<iframe src="http://libraryh3lp.com/chat/lccask-a-librarian@chat.libraryh3lp.com?skin=8804&theme=simpletext&title=Ask+a+Librarian&identity=Librarian" frameborder="1" style="width: 230px; height: 350px; margin-left: 8px; border: 2px solid #344152;"></iframe>
</div>
<!-- Beginning of Qwidget code. -->
<div id="qpchatwidget"></div>
<script id="qp.bootstrap" type="text/javascript" src="http://www.questionpoint.org/crs/js/qwidget/qp.bootstrap.js?langcode=1&instid=12754&skin=gray" charset="utf-8">//<noscript>Please enable javascript to chat with librarians online</noscript></script>
</div>
Thank you.
<!-- Script for Rotation of Library Help and Qwidget -->
<script type="text/javascript">
var checkTime = new Date();
var hours = checkTime.getHours();
var day = checkTime.getDay();
if (day == 0)
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else if ((day > 1 && day < 5) && (hours < 9 && hours > 21))
{
document.getElementById("qpchatwidget").style.display = 'none';
document.getElementById("libraryhelp").style.display = '';
}
else if ((day == 5) && (hours < 9 && hours > 17))
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else if ((day == 6) && (hours < 10 && hours > 16))
{
document.getElementById("libraryhelp").style.display = 'none';
document.getElementById("qpchatwidget").style.display = '';
}
else {
document.getElementById("qpchatwidget").style.display = '';
document.getElementById("libraryhelp").style.display = 'none';
}
</script>
<!-- Beginning of LibraryH3lp code. -->
<div id="libraryhelp" style="display: none;">
<iframe src="http://libraryh3lp.com/chat/lccask-a-librarian@chat.libraryh3lp.com?skin=8804&theme=simpletext&title=Ask+a+Librarian&identity=Librarian" frameborder="1" style="width: 230px; height: 350px; margin-left: 8px; border: 2px solid #344152;"></iframe>
</div>
<!-- Beginning of Qwidget code. -->
<div id="qpchatwidget"></div>
<script id="qp.bootstrap" type="text/javascript" src="http://www.questionpoint.org/crs/js/qwidget/qp.bootstrap.js?langcode=1&instid=12754&skin=gray" charset="utf-8">//<noscript>Please enable javascript to chat with librarians online</noscript></script>
</div>