jquery to make pop-up window tips Windows code sharing

Source: Internet
Author: User
Tags eval

The

 jquery-made pop-up window plugin contains a variety of modes. With the function of receipt function value, you need friends can refer to the following

  Code as follows: <script type= "Text/javascript" src= "Js/jquery-1.7.1.min.js" ></script> <!--[if IE 6]> <script type= "Text/javascript" src= "Js/iepngfix_tilebg.js" ></script> <! [endif]--> <script type= "Text/javascript" > Function position (elem,l,t) {    var isIE6 =!-[1,] &&A MP;!window. XMLHttpRequest;     if (isIE6) {        var style = Elem.style,         Dom  = ' (doc ument.documentelement) ',         left = L-document.documentelement.scrollleft,         Top  = T-document.documentelement.scrolltop;         style.position = ' absolute ';         style.removeexpression (' left ');         style.removeexpression (' top ');         style.setexpression (' left ', ' eval (' + Dom + '. ScrollLeft + ' + Left + ') + ' px ' ');         style.setexpression (' Top ', ' EvaL (' + dom + '. ScrollTop + ' + top + ') + "px");    }else{        elem.style.position = ' fixed ';    }}       fun Ction Scscms_alert (Msg,sign,ok,can) {    var c_=false;//has closed windows to resolve automatic shutdown and manual shutdown conflicts     sign=sign| | ""; nbsp   var s= "<div id= ' mask_layer ' ></div><div id= ' scs_alert ' ><div id= ' alert_top ' ></div ><div id= ' alert_bg ' ><table width= ' the align= ' center ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 1 ' >< Tr> ";     if (sign!= "") s+= "<td width= ' ><div id= ' inco_ ' +sign+" ' ></div></td> ";     s+= "<td id= ' alert_txt ' >" +msg+ "</td></tr></table>";     if (sign== "confirm") {        s+= "<a href= ' javascript:void (0) ' id= ' CONFIRM_OK ' > indeed Fixed </a><a href= ' javascript:void (0) ' id= ' Confirm_cancel ' > Cancellation </a> ';    }else{        s+= "<a href= ' JAvascript:void (0) ' id= ' Alert_ok ' > OK </a> '    }     s+= ' </div><div id= ' Alert_ Foot ' ></div></div> ';     $ ("body"). Append (s);     $ ("#scs_alert"). CSS ("Margin-top",-($ ("#scs_alert"). Height ()/2) + "px"); Center it vertically     $ ("#scs_alert"). focus (); Gets the focus in case the function     position (document.getElementById (' Mask_layer '), 0,0) cannot be triggered after carriage return;     Position (document.getElementById (' Scs_alert '), $ (window). Width ()/2,$ (window). Height ()/2);     if (typeof can = = "number") {   //timed off prompt         settimeout (function () {&nbsp ;           close_info ();        },can*1000);    }     function Close_info () {   //Close prompt window       if (!c_) {  &N Bsp     $ ("#mask_layer"). Fadeout ("Fast", function () {            $ ("#scs_alert"). Remove ();             $ (this). Remove ();        });         c_=true;        }     {    $ ("#alert_ok"). Click (function () {        C Lose_info ();         if (typeof (OK) = = "function") ok ();    });     $ ("#confirm_ok"). Click (function () {        close_info ();         if ( typeof (OK) = = "function") ok ();    });     $ ("#confirm_cancel"). Click (function () {        close_info ();       &NBSP ; if (typeof (CAN) = = "function") can ();    });     function Modal_key (e) {        E = e| | Event         close_info ();         var code = e.which| | Event.keycode;         if (code = | | code = = typeof) {if (ok) = = "function") Ok ()}         if ( Code = =) {if (typeof (CAN) = = "FunctIon ") can ()           }    //binding carriage return with ESC key     if (document.attachevent) & nbsp       document.attachevent ("onkeydown", Modal_key);     Else         Document.addeventlistener ("KeyDown", Modal_key, True); //==================================== The following is a test function =======================================//functions test1 () {    Scscms_alert ("Default cue message"); function Test2 () {    Scscms_alert ("Success Prompt info", "OK")} function Test3 () {    Scscms_alert ("callback function after success prompt" , "OK", function () {alert ("Callback succeeded!") ")}); } function test4 () {    Scscms_alert ("Failure prompt Information", "Error");} function Test5 () {    Scscms_alert ("Failure prompt Information", "Error", function () {alert ("Oh! No! ")}); function Test6 () {    Scscms_alert ("warning message", "warn");} function Test7 () {    Scscms_alert ("warning message", " Warn ", function () {alert (" Oh! Warning! ")}); function Test8 () {    Scscms_alert ("Do you like this informational hint?") "," Confirm ", function () {&nbsP       Scscms_alert ("You chose to like, thank you!") "," OK ");    },function () {        Scscms_alert ("You chose not to like, Khan!") "," error ");    }); function Test9 () {    Scscms_alert ("Automatic shutdown after 3 seconds", "OK", "", 3);} function test10 () {    Scscms_alert (" Ask the information to close the prompt, 3 seconds after the automatic shutdown, no cancellation callback function. Not recommended. "," Confirm ", function () {alert (" OK callback! "). ")},3);} </script>  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.