Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Dynamically Add HTML Element To SharePoint

Posted by ken zheng on January 21, 2009

I have played with the javascript for Item ID in display and edit forms. The interesting part is you can add row into table by Javascript.

<script type="text/javascript">
//
// Item ID in DispForm.aspx and EditForm.aspx
// Feedback and questions: Christophe@PathToSharePoint.com
//
function DisplayItemID()
{
var regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
var qs = regex.exec(window.location.href);
var TD1 = document.createElement("TD");
TD1.className = "ms-formlabel";
TD1.innerHTML = '<h3 class="ms-standardheader">Issue ID</h3>';
var TD2 = document.createElement("TD");
TD2.className = "ms-formbody";
TD2.innerHTML = qs[1];
var IdRow = document.createElement("TR");
IdRow.appendChild(TD1);
IdRow.appendChild(TD2);
var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0];
ItemBody.insertBefore(IdRow,ItemBody.firstChild);
}

_spBodyOnLoadFunctionNames.push("DisplayItemID");
</script>

3 Responses to “Dynamically Add HTML Element To SharePoint”

  1. yagya shree said

    hi,

    i want to add a site visit counter in my sharepoint site but i am unable to do it. is it possible? if yes, how can we do it?

  2. sambita said

    u can insert counter to ur sharepoint site using sharepoint designer.
    Open ur site in sharepoint designer.
    Open ur master page then go to the file menu ,uner insert menu u will find web component ..
    In web component hit counter option is avialable.
    Insert the hit counter to ur master page .No u will be able to chek no of site visit.

    I hope this will help u.

  3. BlackX said

    порно смотреть онлайнСмотреть интимные фотки и ролики

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>