Sharepoint 2010 page is uneditable after adding Content Editor Web Part RRS feed

  • Question

  • Whenever I copy the following code from an existing Sharepoint 2007 site that was successfully migrated to Sharepoint 2010, to a new Sharepoint 2010 site using the Content Editor Web Part a javascript warning is issued stating that "Object does not support property or method".  In Sharepoint 2010 the "page" ribbon fails to load, and the page is uneditable.   Here is a copy of that I am trying to move.  I think the issue must have something to do with Sharepoint's need to strip html content from the web part.   The code was originally sourced from Dynamic Drive, and contains both a header and body portion to the code.  I am also wondering whether or not I can embed custom code into the header portion of the Sharepoint Page using Designer.   I have attempted to put the code into a Site Assets text document, but that results in the page still being uneditable without the content rendering.  Any thoughts on how to get this to work?


    <style style="text/css">

    .dcountstyle{ /*Example CSS to style count up output*/
    font: bold 50px Arial;
    padding: 40px;

    .dcountstyle sup{ /*Example CSS to style count up output*/
    font-size: 50%


    <script type="text/javascript">


    * Dynamic CountUp script- © Dynamic Drive (http://www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.

    function dcountup(startingdate, baseunit){
     this.currentTime=new Date()
     this.startingdate=new Date(startingdate)

    dcountup.prototype.oncountup=function(){} //default action for "oncountup"

     var thisobj=this
     var timediff=(this.currentTime-this.startingdate)/1000 //difference btw target date and current date, in seconds
     var oneMinute=60 //minute unit in seconds
     var oneHour=60*60 //hour unit in seconds
     var oneDay=60*60*24 //day unit in seconds
     var dayfield=Math.floor(timediff/oneDay)
     var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
     var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
     var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
     if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
     else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
     else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
      var secondfield=timediff
     var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
     setTimeout(function(){thisobj.start()}, 1000) //update results every second

    <body {background-image:url('http://mysites:46146/personal/mcniece/Shared%20Pictures/AccidentFreeGraphic_6x6.jpg');}>

    <div id="cpcontainer">&nbsp;</div>

    <script type="text/javascript">

    //SYNTAX: myvariable=new dcountup(past_date_and_time_string, "baseunit")
    var accidentfree=new dcountup("January 26, 2011 00:00:00","days")

     //result is an object containing the current count up date/time, updated every second
     //Available properties: result["days"]
     var mycountainer=document.getElementById("cpcontainer")
     mycountainer.innerHTML="Days Without Recordable Accident: <br /><span class='dcountstyle'>"+result['days']+" <sup>days</sup> </span>"


    Thank you. 

    Tuesday, February 1, 2011 5:52 PM