DEMO code of the js dialog box
The Code is as follows:
// Former Author: http://www.moozi.net
// Modify: hh13774978@126.com, rayking
Function $ (str ){
Return document. getElementById (str );
}
Function _ (str ){
Return document. getElementsByTagName (str );
}
Function msg (boxtitle, boxtype, boxwidth, msg, url ){
$ ("Msg_p_main"). style. width = boxwidth;
$ ("Msg_p_main"). style. left = (_ ("body") [0]. clientWidth-boxwidth)/2;
$ ("Msg_p_main"). style. top = (_ ("body") [0]. clientHeight-220)/2;
Var msg_p_main_but_tmp ="
"
+"+ "Onclick = \" msg_close_tmp_biyuan (); "+ url +" \ "> confirm";
Switch (boxtype * 1 ){
Case 1:
$ ("Msg_p_main_content"). innerHTML = msg + msg_p_main_but_tmp;
// $ ("Msg_p_main_but"). focus ();
Break;
Case 2:
$ ("Msg_p_main_content"). innerHTML = msg + msg_p_main_but_tmp
+"+ "Onclick = 'msg _ close_tmp_biyuan (); '> cancel";
// $ ("Msg_p_main_but"). focus ();
Break;
Case 3:
$ ("Msg_p_main_content"). innerHTML = msg;
Break;
Defualt:
$ ("Msg_p_main_content"). innerHTML = msg;
Break;
}
$ ("Msg_p_main_title"). innerHTML = boxtitle;
$ ("Msg_p_main"). style. zIndex = 200;
$ ("Msg_p_main"). style. display = "";
If (document. all) {// IE
If (! $ ("Msg_p_all_Iframe "))
{
Document. body. appendChild (document. createElement (""));
}
$ ("Msg_p_all"). style. zIndex = 100;
$ ("Msg_p_all"). style. display = "";
$ ("Msg_p_all"). oncontextmenu = function ()
{
Return false;
}
$ ("Msg_p_all_Iframe"). style. zIndex = 99;
$ ("Msg_p_all_Iframe"). style. display = "";
$ ("Msg_p_all_Iframe"). oncontextmenu = function ()
{
Return false;
}
} Else {
$ ("Msg_p_all"). style. zIndex = 100;
$ ("Msg_p_all"). style. display = "";
$ ("Msg_p_all"). oncontextmenu = function ()
{
Return false;
}
}
$ ("Msg_p_main"). oncontextmenu = function (){
Return false;
}
}
Function msg_close_tmp_biyuan (){
$ ('Msg _ p_all '). style. display = 'none ';
$ ('Msg _ p_main '). style. display = 'none ';
If (document. all ){
$ ('Msg _ p_all_Iframe '). style. display = 'none ';}
}
// Move the code in the Add dialog box
/* Drag the mouse */
Var oDrag = "";
Var ox, oy, nx, ny, dy, dx;
Function drag (e, o ){
Var e = e? E: event;
Var mouseD = document. all? 1: 0;
If (e. button = mouseD)
{
If (o. parentNode)
{
ODrag = o. parentNode;
}
Else {oDrag = o ;}
Ox = e. clientX;
Oy = e. clientY;
}
}
Function dragPro (e ){
If (oDrag! = "")
{
// Var obj = document. getElementById ("msg"); // The drag id
Var obj = oDrag; // drag id
Var e = e? E: event;
Obj. style. position = 'absolute ';
Dx = parseInt (obj. style. left );
Dy = parseInt (obj. style. top );
If (isNaN (dx) {dx = 0 ;}
If (isNaN (dy) {dy = 0 ;}
Nx = e. clientX;
Ny = e. clientY;
Obj. style. left = (dx + (nx-ox) + "px ";
Obj. style. top = (dy + (ny-oy) + "px ";
Ox = nx;
Oy = ny;
}
}
Document. onmouseup = function () {oDrag = "";}
Document. onmousemove = function (event) {dragPro (event );}
Document. writeln (""
+"
"
+ ""
+"
"
+"
"+"
"+"
|
| "+"
| "+"
" + "+" OnMouseover = \ "this. src = 'img/bg_13.gif '\"" + "OnMouseout = \" this. src = 'img/bg_05.gif '\ "onMouseup = 'msg _ close_tmp_biyuan ();'" + "OnMousedown = \" this. src = 'img/bg_18.gif '\ "> | "+"
| "+"
"+"
"
+"
"+"
"+"
| "+"
| "+"
| "+"
"+"
"+"
| "+"
| "+"
| "+"
"+"
"
+"
");
Online Demo
Package download