There is a different operation in front of the window that needs to pop up as needed and based on the result of the pop-ups (some user browsers may evaluate the pop-up window) as needed. So helping a friend wrote a very simple JS code. Today, I finished the blog. Post here, I hope to have a little help to friends with similar needs ~~ :) The specific code is as follows: // ********************************** ************************************** / /// 1 page first get the width of the screen and High // 2 pairs of 1024 * 768 and 800 * 600 Customize two windows // 3 Pop-up custom window // 4 If the pop-up is successful, the end // If the pop-up failure (such as the user browser comments, pop-up window), page Jump to new address //// **************************************** ***********************
// ******************************************************** *************** //// Author: tomato // email: supertomato@sjtu.edu.cn// blog: http://blog.9cbs.net/crazytomato/ /// ********************************************************* ******************
VAR screenwidth; // screen width var screenHeight; // screen height var PopWindow; // pop-up window handle VAR windowWidth; // Pop up the width of the window VAR WindowHeight; // Pop up the height of the window
ScreenWidth = Screen.Width; // Get the width of the screen ScreenHeight = Screen.Height; // Get the height of the screen
IF (ScreenWidth == 1024 && ScreenHeight == 768) {WindowWidth = 612; // Modify this data for your pop-up window required for the pop-up window required for 1024 * 768; // Modify this data for you 1024 * 768 The height of the pop-up window required] Else if (ScreenWidth == 800 && ScreenHeight == 600) {WindowWidth = 400; // Modify the width of the pop-up window required for you at 800 * 600 WindowHeight = 300; // Modify this data for your pop-up window required for the 800 * 600} else {windowwidth = 400; // Modify the data for you to pop up the pop-up window required to other resolutions Width WindowHeight = 300; // Modify the height of the pop-up window required for you at other resolutions}
PopWindow = NULL;
PopWindow = WINDOW.Open ('http://www.sjtu.info'/) This data is modified for you to pop up the URL address * /,' _blank ',' width = ' windowWidth ', height = ' WINDOWHEIGHT ', MENUBAR = NO, Toolbar = no, location = no, directories = no, status = no, scrollbars = yes, resizable = no'); // pop-up window, menubar decides whether there is a menu bar, Toolbar decides whether it is There is a toolbar, and local decides whether there is an address bar. Directories determine if there is a connection area, and Status decides whether there is a status bar. Scrollbars determines if there is a scroll bar, resizable decides whether it can change the size if (PopWindow &&! PopWindow.Closed) {// Window Successful pop-up // End} else {window.location.href = "http://www.sjtu.info"; // Modify this data for the page of the page you need to jump to the URL address}