JavaScript Write open windows

xiaoxiao2021-03-06  69

JavaScript introduction 2 Original: Onefi page is built on the window, anything about the web page is related to the window. Let us first let us familiarize with the basic structure of Internet Explorer. Under normal circumstances, the open window has the following four parts:

Title Bar: The window displays the local control area of ​​the title: Various buttons, menu windows: The biggest part on the browser, don't say more! Status bar (Status): Displays the appropriate system information and where JavaScript information is displayed by default, the open new window contains the above part. But when you use Windows.Open (), we can control the style of the newly opened window. grammar:

OnewDoc = Document.open (SURL [, SNAME] [, SFEATURES] [, BREPLACE]) Description:

SURL

Optional. String - Specify the URL address of the new document. If this is not specified, it will be an empty (about: blank).

Sname

Optional. String - the name of the new generation window. It can be used as a value of Target in Form or A.

Blank

SURL is loaded into a new unnamed window.

_MEDIA

SURL is loaded into a media bar. (Only for IE6 and later browser)

_Parent

SURL is loaded on the upper frame of the current frame. If there is no upper layer frame, the value of this item is the same as _self.

_Search

SURL is opened in the browser's lookup window. (Only for IE5 and later browser)

_Self

SURL opens on the current window to overwrite the previous content.

_top

SURL may be loaded on the Frameset if there is no define frameset, which is the same as _self.

SFEATURES

Optional. String - lists the object table and separated by comma. Every item has its own value, they will be separated (such as "fulscreen = yes, toolbar = yes"). The following is a supported feature. ChannelMode = {YES | NO | 1 | 0} Whether the step mode is displayed in the window. The default is NO. Directories = {YES | NO | 1 | 0} Whether to display various buttons in the window. Default is YES. Fullscreen = {YES | NO | 1 | 0} Show browsers in full screen. The default is NO. It is very careful when using this feature. Because this property may hide the browser's title bar and menu, you must provide a button or other tip to help the user closes this browsing window. Alt F4 can close the window. A full screen window must use the ChannelMode mode. Height = NUMBER Specifies the height of the window, the unit is pixel. The minimum is 100. LEFT = Number Specifies the distance from the left frame from the left frame, and the unit is pixel. The value must be greater than or equal to 0. Location = {YES | NO | 1 | 0} Specifies whether to display the address bar in the window. Default is YES. MenuBar = {YES | NO | 1 | 0} Specifies whether to display the menu bar in the window. Default is YES. ResizAble = {yes | no | 1 | 0} Specifies whether to display the handle for the user to adjust the size in the window. Default is YES. Scrollbars = {YES | NO | 1 | 0} Specifies whether to display the lateral or vertical scroll bar in the window. Default is YES. Status = {YES | NO | 1 | 0} Specifies whether to display the status bar in the window. Default is YES. Titlebar = {YES | NO | 1 | 0} Specifies whether to display the title bar in the window. This will be ignored if the HTML Application or a dialog is not called. Default is YES. Toolbar = {YES | NO | 1 | 0} Specifies whether to display the toolbar in the window, including the button such as advance, back, stop, etc. Default is YES. TOP = Number Specifies the location at the top of the window, and the unit is pixel. The value must be greater than or equal to 0. Width = Number Specifies the width of the window, the unit is pixel. The minimum is 100. BREPLACE

Optional. When the SURL is loaded into the same window, this Boolean variable specifies whether this SURL creates an entry or adds to the history of the current window.

True

SURL overrides the historical record of current documentation.

False

SURL creates a new entry in history. Note:

By default, the Open method establishes a window with default width, height, menu, and toolbar. You can specify any one or more feature parameters. These parameters are composed of one or more strings.

Once the feature parameters are specified, other other feature parameters that are not specified are all disabled. Therefore, when the feature parameters are used, you need to define all other feature parameters that need to be used in the window. If the feature parameters are not specified, all features will be retained the original default. In addition to specifying a new value to the feature parameter, a simple column feature name can be valid for the corresponding feature of the window.

Example:

Window.open ("Sample.htm", NULL, "Height = 200, Width = 400, Status = YES, Toolbar = NO, MENUBAR = No, Location = no"); in the example, a set of Sample.htm is established New window. This new window has 200 pixels wide and 400 pixels, with a status bar, but there is no toolbar, menu bar, and address bar. The above is the corresponding code. A more complete example is given below for the generation of the new window. Open window </ title> <script language = "javascript"> function openwindow () {thiswin = window.open ("", null, "width = 300, height = 400") thiswin .document.write ("<head> <title> newwindow </ title> </ head>") thiswin.document.write ("<body> <center> this is a new window! </ center> </ body> ")} </ Script> </ head> <body> <center> <input type =" button "value =" creat new window "onclick =" openwindow ()> </ center> </ body> </ html ></p> <p>The this.document.write in the example is written to the newly generated window. If not, the newly generated window will display an error.</p> <p>Generating a new window is relatively simple, and everyone can master the characteristics described above, basically, can be said to have a method of generating a new window.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-87779.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="87779" 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.063</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 = 'goUWoawW3jqG_2FWZY9WhkNgLIG6zfxXST0IGuKGjeuWRQ3MNhe6x390gv6oAe5s_2BN_2FUvwMTyS_2FTIe3S7_2BezbdFQ_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>