Callout.

http://digsharepoint.com/2013/07/12/create-a-quick-contact-us-or-feedback-form-in-sharepoint-2013-using-callouts/





<script type="text/javascript">


SP.SOD.executeFunc("callout.js", "Callout", function () {



var _link = document.getElementById("ContactusLink");


var listCallout = CalloutManager.createNew({

               launchPoint: _link,

               beakOrientation: "leftRight",

               ID: "CallOut ID",

               title: "Contact Us",

               content: "<div class=\"ms-soften\" style=\"margin-top:2px; \"><hr/></div>"

+ "<div id='confirmationBLOCK' style=\"margin-top:13px;visibility:hidden;\">Thank you for Contacting Us!</div>"

+ "<div class=\"callout-section\" style=\"margin-top:2px;width:95%;Height:200px; \"><textarea id='CommentsArea' style=\"width:100%;height: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;\">Add your Comments here...</textarea></div>",

           });


//Creating a Submit Custom Action

var customAction = new CalloutActionOptions();


customAction.text = 'Submit';


customAction.onClickCallback = function(event, action)

{

var _contactUsTextarea = document.getElementById('CommentsArea');


//Adding the new Contact Us Item in the List.

AddIteminList(_contactUsTextarea.value);


_contactUsTextarea.style.visibility='hidden';


};


var _newCustomAction = new CalloutAction(customAction);


listCallout.addAction(_newCustomAction);


});


function AddIteminList(_contactUsText)

{


var context = new SP.ClientContext.get_current();


var web = context.get_web();


var list = web.get_lists().getByTitle('Contact Us');


var listItemCreationInfo = new SP.ListItemCreationInformation();


var newItem = list.addItem(listItemCreationInfo);


newItem.set_item('Title', _contactUsText);


newItem.update();


context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));

}


function success() {


var _confirmationblock = document.getElementById('confirmationBLOCK');


_confirmationblock.style.visibility='visible';


}


function failed(sender, args) { alert('failed to add a List Item:' + args.get_message()); }


</script>


<div id="ContactusLink" style="width:38%;">If you have any question or Concerns, please feel free to <u><span class=\"ms-commandLink\" style=\"text-align: left;font-size: 14px;\">Contact Us</span></u></div>


你可能感兴趣的:(function,title,content,contact)