ECMA Script: To update the web properties in SharePoint 2010

 

<script language="ecmascript" type="text/ecmascript">

 

    var clientContext = null;

    var web = null;

 

    function updateWebProperties() {

 

        clientContext = new SP.ClientContext.get_current();

        web = clientContext.get_web();

        web.set_title('Updated title');

        web.update();      

        clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

    }

 

    function onQuerySucceeded() {

 

        alert('Web title updated successfully')

    }

 

 

    function onQueryFailed(sender, args) {

 

        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

    }

   

</script>

   

<input id="btnupdateWebProperties" onclick="updateWebProperties()" type="button" value="Updatethe web properties"/>