title: Embedding Sharepoint Web Part in Java Script
body: <p>I've deployed a sharepoint web page and added a custom webpart that visualized data the way customers want to see it. The problem with the webpart is that we cannot scale, modify, or hide it when the user wants to. We thought to embed the Sharepoint webpart in a Java wrapper. Typically this would be easy on a standard HTML page. The question is how do I embed a webpart inside a java wrapper in Sharepoint? </p>
  
  <p>I want to add 2 html buttons, one to show the webpart and one to hide the webpart. The challenge is finding the webpart ID that I can pass to either button to execute the hideMe or showMe java script.</p>
  
  <p>The webpart header:</p>
  
  <pre><code>&lt;WebPartPages:WebPartZone runat="server" Title="loc:FullPage" ID="FullPage" FrameType="TitleBarOnly"&gt;&lt;ZoneTemplate&gt;
  &lt;WpNs0:Trend runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A}" &gt;
  </code></pre>
  
  <p>The code (so far)</p>
  
  <pre><code>&lt;button onclick="HideWebpart('AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A')"&gt;Hide Me&lt;/button&gt;
  &lt;button onclick="ShowWebpart('AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A')"&gt;Show Me&lt;/button&gt;
  
  &lt;script&gt;
  function HideWebpart(AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A)
  {
      var wp=document.getElementById(AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A);
      wp.className = "hidden";
  }
  
  function ShowWebpart(AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A)
  {
      var wp=document.getElementById(AFA8DE0A-E7B4-4580-BFAB-038D96E72F0A);
      wp.className = "";
  }
  &lt;/script&gt;
  </code></pre>