I'm using this on a password-protected site, so I can't share with you a URL. I'm trying to use document.write to white some HTML inside a JS call that's designed to display a different YouTube video based on the time of day. It was working with just text, but not with anything else, it seems. I've tried a number of different methods, none of which seems to work. Here's what I'm doing:
<script type="text/javascript" language="JavaScript">
var myDate = new Date();
/* hour is before noon */
if ( myDate.getHours() >= 12 && myDate.getHours() <= 18 )
{
document.write('<iframe width=\"100%\" height=\"340px\" src=\"http://youtu.be/MswheXWqlbQ\" frameborder=\"0\" allowfullscreen></iframe>');
}
else /* the hour is not between 0 and 24, so something is wrong */
{
document.write('<iframe width=\"100%\" height=\"340px\" src=\"//www.youtube.com/embed/MswheXWqlbQ\" frameborder=\"0\" allowfullscreen></iframe>');
}
</script>