Home > Web Front-end > JS Tutorial > Using javascript to open a modal dialog box (sample code)_javascript skills

Using javascript to open a modal dialog box (sample code)_javascript skills

WBOY
Release: 2016-05-16 17:04:26
Original
1199 people have browsed it

1. Standard method

Copy code The code is as follows:



Example: < span style="CURSOR: pointer" onclick="openWin
('http://www.jb51.net', '500px', '400px', 'no')">Click

2. It should be noted that Firefox does not support this feature. The syntax it supports is

window.open
('openwin.html','newWin', 'modal=yes, width=200,height=200,resizable=no, scrollbars=no' );

3. How to automatically determine the browser

Copy the code The code is as follows:




4. In IE, modal The dialog box will hide the address bar, but not necessarily in other browsers



[Note] In Google Chrome, the effect of this modal will also be invalid.

5. Generally when a dialog box pops up, we all want the background of the entire parent page to change to a semi-transparent color, so that users can see that the back is inaccessible

And after closing the dialog box, I want to restore it

How is this done?

Copy code The code is as follows:

///Display the details of an order Information, through a modal dialog box, and the screen will change color
function ShowOrderDetails(orderId) {
var url = "details.aspx?orderID=" orderId;

//                    $("body")                                                                                                                                                                               
$("body").addClass("body1");

ShowDetailsDialog(url, "600px", "400px", "yes");

          $("body"). -color:#999999;

filter:Alpha(Opacity=40);

}



Copy code


The code is as follows :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>



   
   
   
   


   


   

    点击
   

   



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template