WordPress.org

Ready to get started?Download WordPress

Forums

Adding Javascript to Page? (2 posts)

  1. submo6
    Member
    Posted 5 years ago #

    I am currently trying to add the following Javascript into one of my Pages, it is not showing up. If I put the Javascript into my sidebar it works perfectly fine. I just do not want to put it into my sidebar, I want it to work on one of my Pages.

    The script I am trying to use is this:

    <SCRIPT LANGUAGE="JAVASCRIPT">
    			today = new Date();
    			BigDay = new Date("July 15, 2011")
    			msPerDay = 24 * 60 * 60 * 1000 ;
    			timeLeft = (BigDay.getTime() - today.getTime());
    			e_daysLeft = timeLeft / msPerDay;
    			daysLeft = Math.floor(e_daysLeft);
    			e_hrsLeft = (e_daysLeft - daysLeft)*24;
    			hrsLeft = Math.floor(e_hrsLeft);
    			minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
    			document.write(daysLeft + " days");
    			</SCRIPT>

    Any suggestions on how I can get this to show up?

  2. Josh Leuze
    Member
    Posted 5 years ago #

    The WordPress editor doesn't play well with code that is out of its bounds, and this is out of its bounds.

    You can add code like this to your pages and posts by using the Raw HTML plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic