JavaScript Window Function Guide Create Dialog

zhaozj2021-02-08  199

JavaScript Window Function Guide Create Dialog

(Author: hear the wind compiler 2001 at 11:35 on January 19)

JavaScript supports several built-in dialogs: Window.Art (), Window.confirm (), and Window.Prompt (). When a dialog is pop-up, the user cannot focus on the initial page unless the dialog operation ends. In other words, the dialog is always focused. Internet Explorer supports some ways to use them to apply them on any new window: ShowModalDialog () (Internet Explorer 4 and above) ShowModelessDialog () (Internet Explorer 5 and Above) The following is the syntax of these methods: vreturnValue = Window.ShowModaldialog (SURL [, Varguments]); vreturnValue = Window.showModelessDialog (SURL [, Varguments] [, SFEATURES]); the first parameter is a string, which specifies loading in a new window and The document URL is displayed. The second parameter, Varguments, is a Variant, which specifies the command to display the document. When using this parameter, you can pass any type of array or value. The dialog can pass the value to the caller from the Dialogarguments property of the Window object. When a new window is opened by one of the methods, the new window (dialog box) is closely written with the Dialogarguments property, which contains the value of the Varguments parameter assigned to the call method. Let's take a look at the following statement: Window.ShowModalDialog ("MODALURL.HTML", Window; note that the second command parameter is actually the Window object of the current browser window.

Below is the code: change the url </ title> <script language = "javascript"> <! - function loading (menu) {ix (Window.Dialogarguments && DialogAmber) .location) {dialogarguments.location.href = menu.Options [menu.selected ".value; window.close ();}} // -> </ script> </ head> <body> Pick your favorite Investment Site : <P> <form> <select name = "menu"> <option value = "http://www.fool.com/"> fool.com (The Motley Fool) <option value = "http: // www .INVESTOR.com / "> Moneycentral Investor <option value =" http://www.theestreet.com/ "> theestet.com </ select> <input type =" button "value =" LOAD "onclick =" "> </ form> </ body> </ html> When the user clicks on the" Load "button in the dialog, the URL of the opener window becomes the selected value. For the URL of the numerical window document, we must assign a value to the location.href attribute that requires a Window object. Here, we specify that the caller's Window object is the second parameter of the ShowModalDialog () method, so the Dialogarguments attribute in the new window (dialog box) corresponds to the caller's Window object. Attention The object detection block of the function begins. Because the Dialogarguments attribute exists only in a window created by showmodaldialog () and showmodelessDialog (), we must confirm that the attribute is existed before use. Moreover, we need to find a location.href property to confirm that the Dialogarguments property really corresponds to a legitimate Window object. The last statement of the LOAD () function closes the dialog, and the specified document can be loaded in the original window. Note that if we use the showmodelessdialog () method to replace the showModalDialog () method, we do not need to close the window, because even if the dialog is still open, the new URL will still be loaded below the window (opener). Here, when the caller's URL changes (call the new page), the dialog is turned off.</p> <p>When ShowModelessDialog () is executed in Internet Explorer 5, a dialog appears in front of the browser window. The user can still manipulate the following window, but the dialog will always be on. The dialog is associated with the open browser window, so if the user generates a different window, the dialog is hidden behind it with its generator. Note that a Modeless dialog is actually connected to a document containing a script that generates its, if the user loads another different URL in the opener window, the dialog box will automatically shut down. The ShowModalDialog () method in Internet Explorer 4 is completely different. It creates a Modal dialog and keeps focus until it is closed. The user cannot access the opener window at all. A Modal dialog is associated with the open browser window, so if the user produces a different browser window, the dialog is hidden below the active window with its original window. It is time to come back to discuss the parameters of ShowModalDialog () and ShowModelessDialog () methods. The third parameter, SFEATURES, is a string that specifies the modified feature of the dialog window, which is the use of one or more of the following, a comma-separated value: DialogHeight: IHEIGHT Settings the height of the dialog window. Although the user can manually adjust the height of a dialog as a smaller value (required to generate the dialog that is sized), you can specify the minimum DialogHT is 100 pixels. Note that in Internet Explorer 4.0's default measurement unit "EM" in Internet Explorer 5, it is PX (pixel) in Internet Explorer 5. To maintain consistency, specify DialogHeight and DialogWidth in pixels when designing the Modal dialog. DialogWidth: iWidth Set the width of the dialog window. Dialogleft: The IXPOS Settings dialog window is relative to the LEFT location in the upper left corner of the desktop. Dialogtop: The iYPOS Settings dialog window is relative to the top position in the upper left corner of the desktop. Center: {YES | NO | 1 | 0} Specifies whether to place the dialog on the desktop, the default value is "Yes". To avoid hooking, you can set it to Dialogleft or Dialogtop. Help: {YES | NO | 1 | 0} Specify whether the context-sensitive help icon is displayed in the specified dialog window. The default is "yes". Resizable: {yes | no | 1 | 0} (Internet Explorer 5 and Above) Specifies whether the dialog window can change. The default is "no". Status: {yes | no | 1 | 0} (Internet Explorer 5 and above) Specify whether dialog window displays status bar. For non-dependent dialog windows, the default value is "YES"; for the dependent dialog window, the default value is "no". Object Detection ShowModalDialog () and showModelessDialog () methods are not supported by all browsers that support JavaScript.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-3426.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="3426" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.031</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'SXD4u5rn_2FeZsQ4PutDoBut4odPC2UVrlnK2sr8gjFZ15eD150lA02t4yovxLeJBtDzGoppkq5aQjElJ96GYVPQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>