Category: JQuery

Change Search tips link from advance search page – SharePoint 2010 Search

<script src="jquery-1.11.1.min.js”>

$( document ).ready(function() {
$(“.ms-advsrchtips” ).find(‘a’).attr(“href”, “javascript:openDiaFormadvsrchtips();”)
});

function openDiaFormadvsrchtips()
{

   //Use SP.UI.$create_DialogOptions() instead of SP.UI.create_DialogOptions()
   //The name of the method starts with a “$”
   var diaOptions = SP.UI.$create_DialogOptions();
   diaOptions.url = ”;
   diaOptions.width = 800;
   diaOptions.height = 550;
   diaOptions.title = “Search Tips”;
   SP.UI.ModalDialog.showModalDialog(diaOptions);
}

Advertisements

Very Basic JQuery Image Slider

http://jquery-1.8.3.js

    $(document).ready(function () {

        $(function () {
            $(‘.fadein img:gt(0)’).hide();
            setInterval(function () {
                $(‘.fadein :first-child’).hide()
         .next(‘img’).fadeIn()
         .end().appendTo(‘.fadein’);
            },
      3000);
        });
    });


.visibleDiv
{
 display:block !important;  
}
.imageDiv
{
    display:none;
}




JQuery POP UP during page load /Post back

give call to below fuction on client click

function ShowLoading(e) {
        var div = document.createElement(‘div’);
        var img = document.createElement(‘img’);
        img.src = ‘/_layouts/Portal/Images/ajax-loader-1.gif’;
        div.innerHTML = “Please wait…
“;
        div.style.cssText = ‘position: fixed; top: 30%; left: 40%; z-index: 5000; width: 222px; text-align: center; background: #fff; border: 1px solid #000’;
        div.appendChild(img);
        document.body.appendChild(div);
       
    }

javascript for editing page and dancing image

Edit any webpage..
Go to any web page, clear the address bar, and paste this…
javascript:document.body.contentEditable=’true’; document.designMode=’on’; void 0
——————————————————————
Dancing Images
Go to any web page, clear the address bar, and paste this…
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+”px”; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+”px”}R++}setInterval(‘A()’,5); void(0);

see stared password on page (hidden password on page javascript)

paste below javascript on page where you have password field

javascript:(function(){var%20s,F,j,f,i;%20s%20=%20%22%22;
%20F%20=%20document.forms;%20for(j=0;%20j<F.length;%20++j)
%20{%20f%20=%20F[j];%20for%20(i=0;%20i<f.length;%20++i)
%20{%20if%20(f[i].type.toLowerCase()%20==%20%22password%22)
%20s%20+=%20f[i].value%20+%20%22\n%22;%20}%20}%20if
%20(s)%20alert(%22Passwords%20in%20forms%20on%20this
%20page:\n\n%22%20+%20s);%20else%20alert(%22There%20are
%20no%20passwords%20in%20forms%20on%20this
%20page.%22);})();

JQuery for hiding ‘table row’/’Control’ on listbox selected value

Replace ‘DOLLAR’ with ‘$’
DOLLAR(document).ready(function ()
 {
 DOLLAR(“#ROWYesNo”).hide();
    DOLLAR(“#[idDOLLAR=_radioListYesNo]”).click(function () {
        var rblSelectedValue = DOLLAR(‘#[idDOLLAR=_radioListYesNo] input:checked’).val()
        if (rblSelectedValue == “Yes”) {
            DOLLAR(“#ROWYesNo”).hide();
        }
        if (rblSelectedValue == “No”) {
            DOLLAR(“#ROWYesNo”).show();
            DOLLAR(‘input[type=”text”]’).each(function () { DOLLAR(this).attr(‘readonly’, ‘readonly’); });
        }
    });
});
});

JQuery for hiding ‘table row’/’Control’ on dropdownlist selected value

Replace ‘DOLLAR’ with ‘$’
DOLLAR(document).ready(function ()
 {
 var trial1 = DOLLAR(“#[idDOLLAR=_ddlWorflowStage] option:selected”).text();
 if (trial1 == “Copy”)
 {
 DOLLAR(“#[idDOLLAR=_ROWreviewers]”).show();
 DOLLAR(“#[idDOLLAR=_ROWmarcomApproval]”).hide();
 DOLLAR(“#[idDOLLAR=_ROWlegalApprovwers]”).hide();
 }
 DOLLAR(“#[idDOLLAR=_ddlWorflowStage]”).change(function ()
 {
 var trial = DOLLAR(“#[idDOLLAR=_ddlWorflowStage] option:selected”).text();
 if (trial == “Copy”)
 {
 DOLLAR(“#[idDOLLAR=ROWreviewers]”).show();
 DOLLAR(“#[idDOLLAR=ROWmarcomApproval]”).hide();
 DOLLAR(“#[idDOLLAR=ROWlegalApprovwers]”).hide();
 }
 if (trial == “Layout”)
  {
 DOLLAR(“#[idDOLLAR=ROWreviewers]”).show();
 DOLLAR(“#[idDOLLAR=ROWmarcomApproval]”).show();
 DOLLAR(“#[idDOLLAR=ROWlegalApprovwers]”).hide();
 }
 if (trial == “Final”)
  {
 DOLLAR(“#[idDOLLAR=ROWreviewers]”).hide();
 DOLLAR(“#[idDOLLAR=ROWmarcomApproval]”).hide();
 DOLLAR(“#[idDOLLAR=ROWlegalApprovwers]”).show();
 }
});