Ask a questionAsk a question
 

AnswerDifferent background colors for two webparts on same page.

  • Wednesday, November 04, 2009 8:27 PMVenkatMOSS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Bussines requirement is to have two different back ground colors to two webparts on same webpage.
    Ho can I solution to this requirement in MOSS 2007.

    Is it possible to provide other webpart property Backcolor (same as Title)?

Answers

All Replies

  • Wednesday, November 04, 2009 9:13 PMHereICome SharePoint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi You can add an hidden content editor web part on the same page, where your both web parts are and add javascript to change background color for both the web part.

    <script type = "text/javascript">
    window.onload=function()
    {


    document.getElementById("tocwp").style.backgroundcolor="#FFFFFF";
    }

    </script >
  • Thursday, November 05, 2009 4:42 AMVenkatMOSS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
      Thanks for reply.

    Here "tocwp" is id of webpart right?
    Where and how can I get id of my webparts?

    Is it posible to change background by adding style class to core.css?

    Thanks.
  • Friday, November 06, 2009 3:39 AMAaron Han - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

           I suggest you to use the Internet Explorer Developer Toolbar for client script and html  development, you can  get control’s id or name directly.

           And what’s more, when using content editor web part to append JS function, please do not forget to add  _spBodyOnLoadFunctionNames.push("functionName")  function.

           See: http://sharepointsolutions.blogspot.com/2007/07/adding-javascript-to-content-editor-web.html

           Finally, it is strongly not recommend to modify core.css directly, please achieve your requirement with js or SPD css modification only.

     

           Hope this can help.  

    Best Regards,

    -Aaron