Java Script Help Please

1 replies
Hello,

I have a script that when it runs should open up a popup window and display the message and current date. Below is the script but it doesn't work. Maybe I'm making a simple mistake?


Code:
<script type="text/javascript">
function max_window()
{
window.moveTo(0,0);

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var width = (screen.width  - width)/2;
var height = (screen.height - height)/2;



if (document.all)
{
top.window.resizeTo(screen.availWidth,screen.availHeight);
}

else if (document.layers||document.getElementById)
{
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
{
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}

$(document).ready(function() {
$.msgbox(
"<strong>Dear  Visitor!</strong><br/><br/><br/><small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>Today Only <strong>(Thursday, November 07, 2013)</strong> : <br/><br/><br/>We Are Offering A Free Credit Score to all  users!<br/><br/><br/>", {type: "info", buttons: [{type: "submit", value: "OK"}]});
$('.jquery-msgbox').click(function(e) {    $('.jquery-msgbox form').submit() });
$('.left-col').click(function(e) {    max_window(); window.location = "http://cpvtrack202.com/base2.php"; });
});
</script>
When I remove the date part the popup works fine so I know the popup works its just that when I add in the date part it breaks something.
#java #script
  • Profile picture of the author Brandon Tanner
    You're missing semicolons at the end of several of your variable declarations, and also in a few other places.
    Signature

    {{ DiscussionBoard.errors[8682558].message }}

Trending Topics