JavaScript reference tutorial

xiaoxiao2021-03-06  80

JavaScript reference tutorial

By Micro

Document object

Now we will start discussing more "actual" topics - document objects (DOM). Document object refers to an object that is divided in the web document. There is a few "big" objects in JavaScript: Window, Document, Location, Navigator, Screen, History, etc. Below is a document object tree, you can see the "spectacular" scenario containing the object under the object. To reference an object, you have to list the parent's objects. For example, to reference a text box "CustomerName" of a form "ApplicationForm", you must use "Document.Applicationform.customername".

Some objects in the table below are all written, and some are beginning to uppercase letters. Subjects at uppercase letters, reference to this object does not use the name listed in the table, and directly use the "name" of the object (ID or Name, which is explained below), or specify the object array of object it belong.

Here we are not prepared to explain the "event" of the object, although we will also list the events that can respond to the object. We will explain the event in the next chapter "Event Process".

Navigator Screen WinDow

History location frames []; frame document

ANCHORS []; links []; link applets [] embeds [] forms []; form

Button Checkbox Elements []; Element Hidden Password Radio RESET SELECT

Options []; option submit text textarea images []; Image Browser Object Screen Object Window Object History Address Object Frame Object Document Object Connection Objects Java Small User Object Plugin Object Form Object Button Object Check Box Object Form Element Object Hide Object Password Input Area Object Single Domain Object Reset Button Object Select Zone (drop-down menu, list) Object selection object Submit button object text box object Multi-line text input area object picture object

The Navigator browser object reflects the information of the currently used browser.

Attributes

AppCodename Returns the "Code" (?) of the browser (?), popular IE and NN return 'Mozilla'. AppName returns the browser name. IE returns 'Microsoft Internet Explorer', NN returns 'Netscape'. AppVersion returns the browser version, including the large version number, small version number, language, operational platform and other information. Platform returns the action platform of the browser, returns 'Win32' on the browser on Windows 9x (case of case where cases may be different). UseERAGENT returns all the above information. For example, IE 5.01 returns 'mozilla / 4.0 (compatible; msie 5.01; windows 98)'. JavaEnabled () returns a Boolean value that represents the current browser allows Java to be allowed.

The Screen screen object reflects the current user's screen settings.

Attributes

Width returns the width of the screen (the number of pixels). Height returns the height of the screen. AvailWidth returns the available width of the screen (removed some of the widths occupied by something that do not automatically hide the similar taskbar). AvailHeight Returns the available height of the screen. ColorDepth Returns the number of bits used in the current color settings - 1: black and white; 8: 256 colors; 16: Enhance color; 24/32: True color Window window object's largest object, it describes a browser window. When it is generally referenced to its properties and methods, it is not necessary to use "Window.xxx" in the form of "XXX" directly. A framework page is also a window.

Attributes

The name of the Name window, the open () method called by opening its connection () or frame page ( tag: " Close window ". Parent Returns the frame page object to which the window belongs. TOP returns the top of the entire browser window to the top page object. History historical object, see below. Location address object, see below. Document document object, see below.

method

Open () opens a window. Usage: OPEN (, , ); : Describes which page opens open. If you leave a blank (''), you don't open any web page. : Describes the name of the window opened, you can use the built names such as '_top', '_ blank'. The name here is the same as "". : Describe the appearance of the opened window. If you only need to open a normal window, the string leaves the blank (''), if you want to specify the appearance, write one to multiple parameters in the string, with a comma between parameters.

Example: Open a clean window 400 x 100: open ('', '_ blank', 'width = 400, height = 100, menubar = no, toolbar = no, location = no, directories = no, status = no, Scrollbars = yes, resizable = yes') Parameters TOP = # Window top Level of pixels at the top of the screen Left = # Window left left side left the left-left pixel number width = # window Width = # Window high menubar = ... window Is there a menu, value Yes or NOTOOLBAR = ... window has a toolbar, values ​​YES or NOLOCATION = ... Window has an address bar, value Yes or Nodirectories = ... window has a connection area, take Value Yes or Noscrollbars = ... window has no scroll bar, value YES or NOSTATUS = ... window There is no status bar, value Yes or NORSIZABLE = ... window does not adjust the size, value Yes or NO

The OPEN () method has a return value, returning is the window object it open. and so,

Var newWindow = Open ('', '_ blank');

This assigns a new window to the "NewWindow" variable, and then control the window through the "newWindow" variable.

Close () Close an open window. Usage: Window.close () or Self.close (): Close this window; .close (): Turn off the specified window. If the window has a status bar, the browser will warn: "The page is trying to close the window, is it close?" Then wait for the user to choose whether it is; if there is no status bar, call the method to close the window directly. Blur () makes the focus from the window, and the window becomes "non-active window". FOCUS () is a window to get focus and become a "active window". However, in Windows 98, this method can only flash the title bar of the window and the corresponding button on the taskbar, prompting the user that the window is trying to get the focus. ScrollTo () Usage: [.] ScrollTo (x, y); roll the window so that the document is rolled from the upper left angle (x, y) to the upper left corner of the window. Scrollby () usage: [.] scrollby (deltax, deltay); roll the window to the right to scroll down the Deltay pixels. If the negative value is taken, scroll in the opposite direction. ResizTo () Usage: [.] resizeto (width, height); adjust the window to the width width pixel, high HEIGHT pixels. Resizeby () Usage: [.] Resizeby (deltaWidth, DeltaHT); adjust the window to adjust the size, broaden the deltaWidth pixels, high increasing DeltaHeight pixels. If the negative value is taken, it is reduced. Alert () Usage: Alert (); pop up a dialog containing only the "OK" button, display the content of the , read the entire document, Script runs, until the user presses " determine". Confirm () usage: confirm (); pop up a dialog box containing the "OK" and "Cancel" button, display the contents of the , require the user to make a selection, read the entire document, Script It will be suspended. Returns the true value if the user presses "OK", if "cancel" is pressed, then returns the false value. Prompt () usage: prompt ( []); pop up a dialog box containing "confirmation" "cancel" and a text box, display content, requires the user in the text box Enter some data, read the entire document, Script run will be suspended. If the user presses "confirm", return to the content existing in the text box, return NULL values ​​if the user presses "cancel". If you specify , there will be a default value in the text box. event

OnLoad; OnResize; Onfocus; OneRror

History historical object history object refers to the browser browsing history. In view of the safety needs, the object receives a lot of restrictions, and now only the following properties and methods remain.

Attributes

Length history of history. History that JavaScript can manage is limited to the range of "advancement" "back" keys in the browser. This attribute returns the sum of the number of addresses included under "advancement" and "back" two buttons.

method

Back () back, follow the "Back" button is equivalent. Forward () advance, follow the "advance" button is equivalent. Go () usage: History.go (x); go to the specified address within the scope of history. If x <0, return X address, if x> 0, then forward X addresses, if x == 0, refresh the top now open. History.go (0) is equivalent to location.Reload (). Location Address Objects It describes the address opened by a window object. To indicate the address of the current window, just use "location" to do it; if you want to indicate the address of a window, use " .location".

Note that the two addresses belonging to different protocols or different hosts cannot be referenced to each other's Location objects, which is for security needs. For example, the current window opens "www.a.com", another window (object name: bwindow) opens "www.b.com" webpage. If you use "bwindow.location" in the current window, it will be wrong: "No Permissions". This error is to receive processing with the error handler (Event Handler, see the OneRror event).

Attributes

Protocol Returns the protocol of the address, with the value of 'http:', 'https:', 'file:', and so on. Hostname returns the host name of the address, for example, an address of "http://www.microsoft.com/china/", location.hostname == 'www.microsoft.com'. Port number of port returns the address, the general HTTP port number is '80'. Host returns host name and port number, such as: 'www.a.com: 8080'. Pathname Returns the path name, such as "http://www.a.com/b/c.html" ,location.pathname == 'b / c.html'. Hash returns "#" and later, such as "http://www.a.com/b/c.html#chapter4" ,location.hash == '# chapter4'; if there is no" # "in the address, Return to the empty string. Search returns "?" and later content, such as "http://www.a.com/b/c.asp?selection=3&jumpto=4" ,location.search == '? Selection = 3 & jumpto = 4'; if If there is no "?" In the address, it returns an empty string. HREF returns all the above content, that is, returns the entire address. How to display it on the address bar of the browser to return. If you want a window object to open an address, you can use "location.href = '...'", you can also use "location = '...'" to achieve this purpose.

method

Reload () is equivalent to "Refresh" or "Netscape" button on your browser. Replace () opens a URL and replaces the address of the current location in the historical object. After opening a URL with this method, press the "Back" button of the browser will not return to the page you just. Frames []; Frame Framework See "Use Framework and Cookies" chapter.

Document Document Object Describes the documentation of the current window or specifying a window object. It contains the content from to . Usage: Document (Current Window) or .document (Specified Window)

Attributes

Cookie For cookies, please refer to Chapter of "Use Framework and Cookies". LastModified Current Date of Documentation is a Date object. Referrer If the current document is opened by clicking on the connection, ReferR returns the original URL. Title refers to the text of ... </ title> in the <head> tag. This property does not accept assignment in Netscape. FGColor refers to the text color represented by the Text property of the <body> tag. BGColor refers to the background color represented by the BGColor property of the <body> tag. LinkColor refers to the connection color represented by the LINK property of the <body> tag. AlinkColor refers to the active connection color indicated by the ALINK attribute of the <body> tag. VLINKCOLOR refers to the accessed connection colors indicated by the VLINK attribute of the <body> tag.</p> <p>method</p> <p>Open () opens a document so that JavaScript writes data to the current location of the document (refers to the location of JavaScript). Usually do not need this method, JavaScript is automatically called when needed. Write (); Writeln () writes data to the document, and the writes are handled as a standard document HTML. The difference between Writeln () and Write () is that Writeln () will add a wrap after writing data. This wrap is only in HTML, and the specific situation can be unable to be displayed, and the location of the JavaScript is inserted. If inserted into the <pre> mark, this wrap will also be embodied in the document. Clear () Clears the current document. Close () Close the document and stop writing data. If the Write [Ln] () or CLEAR () method is used, you must use a close () method to ensure that the changes made can be displayed. If the document has not fully read, that is, JavaScript is inserted in the document, so it is not necessary to use this method.</p> <p>Now we have enough knowledge to do the following, some of the pop-up updates are notified.</p> <p><script language = "javascript"> <! - var whatsnew = Open ('', '_ blank', 'top = 50, left = 50, width = 200, height = 300,' 'menubar = no, toolbar = NO, Directories = NO, LOCATION = NO, ' ' status = no, resizable = no, scrollbars = yes '); whatsnew.document.write (' <center> <b> update Notice </ b> </ center> '); whatsnew.document.write (' <p> last update date: 00.08.01 '); whatsnew.document.write (' <p> 00.08.01: Added "My Favorite" section. '); Whatsnew.Document.write ('<p align = "right"> ' <a href="javascript:Self.close()"> Close window </a> '); whatsnew.document.close (); -> </ script> Of course, you can also write an HTML file first, and directly load this file in the open () method.</p> <p>ANCHORS []; links []; LINK connection object</p> <p>Usage: Document.Anchors [[x]]; Document.Links [[x]]; <anchorid>; <linkid> Document.Anchors is an array that contains all anchors in the document (including Name property <A) ), According to the order in the document, starting a subscript from 0 to each anchor mark. Document.links is also an array that contains all connection tags in the document (containing the <area> tag in the <AP> tag segment in the <map> tag) in the document, and starts from 0 to each in the order in the document. The connection tag defines a subscript. If a <a> tag has both Name attributes, there is an HREF attribute, it is an anchor object and a LINK object. In IE, if "ID =" "attribute is added in the <A> mark, this <A> object is given a identification (ID), and only" <ID> "is required when calling this object. Ok. Many document components can use this method to give an ID, but be careful not to have two IDs.</p> <p>Anchors and Links are arrays, with an array of properties and methods. A single anchor object is not attribute; the properties of a single Link object are asked.</p> <p>Attributes</p> <p>Protocol; host; pathname; haveh; search; href is the same as the location object. TARGET returns / specifies the target window (string), which is the same as the target attribute in the <A> tag. event</p> <p>Onclick; onmouseover; onmouseout; onmouseup</p> <p>Applets [] Java small program object is an array that contains the Applet object (Java applet) in the document. As an array, there is an array of properties and methods. With regard to the properties and methods of a single applet object, I reference a sentence: "Applet object inherits all public properties and methods of the Java applet." (English original: The applet object inherits all public property of the java applet./the applet Object Inherits All Public Methodss of The Java Applet.) Because I am very disgusted Java applet, I am not interested in what "public" "private" problem is not interested.</p> <p>Embeds [] Plugin Object It is an array that contains all plugins in the document (<Embed> tag). Because each plugin is different, each EMBED object also has different attributes and methods.</p> <p>Forms []; Form form object Document.Forms [] is an array that contains all forms in the document (<form>). To reference a single form, you can use Document.Forms [x], but in general, people will do this: Plus "Name =" "attribute in the <form> tag, then" Document. " Table Single> "You can reference it.</p> <p>FORM object's properties</p> <p>Name returns the name of the form, that is, <form name = "..."> attribute. Action returns / sets the submission address of the form, which is the <form action = "..."> attribute. Method returns / sets the form of submission, that is, <form method = "..."> properties. Target returns / sets the window returned after the form is submitted, that is, the <form target = "..."> property. Encoding returns / sets the encoding method of the form submitted, that is, <form encType = "..."> attribute. Length returns the number of elements contained in this form.</p> <p>method</p> <p>reset () reset the form. This is the same as pressing the "Reset" button. Submit () submits the form. This is the same as pressing the "Submit" button.</p> <p>event</p> <p>Onreset; OnSubmit</p> <p>The following from "Button" to "textarea" is the element object of the form.</p> <p>Button button object is specified by "<input type =" button ">". Quote a Button object, you can use the <Document Object>. <Form object>. <Button name>. <Button Name> Refers to the value of "Name =" "attribute in <input> tag. This method can be used in any form element.</p> <p>Attributes</p> <p>Name Return / Set the element name specified with <input name = "...">. Value Returns / Sets the value of the element specified with <input value = "...">. Form returns a form object that contains this element. method</p> <p>Blur () removes the focus from the object. FOCUS () allows objects to get focus. Click () simulates the mouse click on the object.</p> <p>event</p> <p>Onclick; onmousedown; onmouseup</p> <p>CheckBox check box object is specified by <input type = "checkbox"> ".</p> <p>Attributes</p> <p>Name Return / Set the element name specified with <input name = "...">. Value Returns / Sets the value of the element specified with <input value = "...">. Form returns a form object that contains this element. Checked Returns / Set whether the check box object is selected. This is a Boolean value. DEFAULTCHECKED Returns / Set whether the check box object is selected by default. This is a Boolean value.</p> <p>method</p> <p>Blur () removes the focus from the object. FOCUS () allows objects to get focus. Click () simulates the mouse click on the object.</p> <p>event</p> <p>Onclick</p> <p>Elements []; Element Form Element Objects <Form Object> .Elements is an array that contains all objects of the form. Generally, we don't have to use the array, and the specific objects are directly referenced.</p> <p>Hidden hidden object is specified by "<input type =" hidden ">".</p> <p>Attributes</p> <p>Name Return / Set the element name specified with <input name = "...">. Value Returns / Sets the value of the element specified with <input value = "...">. Form returns a form object that contains this element.</p> <p>The Password Password Enter the area is specified by "<input type =" password ">".</p> <p>Attributes</p> <p>Name Return / Set the element name specified with <input name = "...">. Value Returns / Set the current value of the password input area. DEFAULTVALUE Returns the default value specified with <input value = "...">. Form returns a form object that contains this element.</p> <p>method</p> <p>Blur () removes the focus from the object. FOCUS () allows objects to get focus. SELECT () Select all text in the password input area.</p> <p>event</p> <p>ONCHANGE</p> <p>The RADIO single-selection domain object is specified by "<input type =" radio ">". A set of Radio objects have a common name (name attribute), in which document.formname.radioname has an array. To access a single RADIO object: Document.formname.radioname [x].</p> <p>Properties of a single Radio object</p> <p>Name Return / Set the element name specified with <input name = "...">. Value Returns / Sets the value of the element specified with <input value = "...">. Form returns a form object that contains this element. Checked returns / set whether the single-selection domain object is selected. This is a Boolean value. DefaultChecked Returns / Set whether the object is selected by default. This is a Boolean value.</p> <p>method</p> <p>Blur () removes the focus from the object. FOCUS () allows objects to get focus. Click () simulates the mouse click on the object.</p> <p>event</p> <p>Onclick</p> <p>The RESET reset button object is specified by "<input type =" reset ">". Because RESET is also a button, there is also the properties and methods of the Button object. As for the "OnClick" event, it is generally replaced with the ONRESET of the Form object. SELECT Selection Area (drop-down menu, list) object is specified by "<select>".</p> <p>Attributes</p> <p>Name Return / Set the element name specified with <input name = "...">. Length returns the number of options under the SELECT object. SelectedIndex returns the subscript of the selected option. This subscript is the location of this option in an Options [] array. If the SELECT object allows multiple selections, returns the subscript of the first selected option. Form returns a form object that contains this element.</p> <p>method</p> <p>Blur () removes the focus from the object. FOCUS () allows objects to get focus.</p> <p>event</p> <p>ONCHANGE</p> <p>Options []; Option Select Object Options [] is an array containing an Option object under the same Select object. The Option object is specified by "<options>" under "<select>".</p> <p>Options [] Array properties</p> <p>Length; SELECTEDIndex is the same as the same name properties of the SELECT object.</p> <p>Properties of a single Option object</p> <p>TEXT Returns / Specifies the text value of the Option object to return / specify the value of the Option object, consistent with <options value = "...". INDEX returns the subscript of the Option object. There is nothing to say about this, because you want to specify a specific OPTION object, you must first know the subscript of the object. This property does not seem to use. SELECTE Returns / Specifies whether the object is selected. You can dynamically change the selected item by specifying True or FALSE. DEFAULTSELECTED Returns whether the object is selected by default. TRUE / FALSE.</p> <p>Submit Submit button object is specified by "<input type =" submit ". Because Submit is also a button, there is also the properties and methods of the Button object. As for the" OnClick event, the ONSUBMIT in which the FORM object is generally used.</p> <p>TEXT text box object is specified by "<input type =" text ">". The Password object is also one of the Text object, so all attributes, methods, and events of Password objects are available.</p> <p>TextArea Multi-line text input area object is specified by "<textarea>". TEXTAREA objects All properties, methods, and events are the same as that of text objects, that is, the same as the Password object.</p> <p>Images []; Image Image Object Document.Images [] is an array that contains all images in the document (<IMG>). To reference a single picture, you can use document.images [x]. If a picture contains the "name" attribute, it is to define a picture in this format of "<img name =" ... ">", you can use "Document.Images ['...']" Method to reference pictures. In IE, if a picture contains ID attributes, it is to define a picture in this format using "<img id =" ... ">", you can use "<imageid>" directly to reference the image.</p> <p>Properties of a single image object</p> <p>Name; Src; LowSrc; width; height; vSpace; hspace; border; these properties are the same as the same name attribute in the <IMG> tag. In Netscape, other properties (almost all) cannot be changed, even if it is changed, the effect can not be displayed in the document. These properties are most useful to SRC, and can change the image in real time by assigning a value to the SRC property. event</p> <p>Onclick</p> <p>Image object not displayed in the document</p> <p>The image object not displayed in the document is defined using a VAR statement:</p> <p>Var myimage = new image (); or var myimage = new image (<image address string>);</p> <p>The MyImage variable can then be treated like a typical image object. But since it is not displayed in the document, the following properties: LowSRC, Width, Height, vSpace, Hspace, Border is not used. Generally, this object is only one: pre-read picture (preload). Because when assigning the SRC attribute of the object, the reading of the entire document, the operation of JavaScript is paused, allowing the browser to read pictures. After reading the picture, there is a picture of the picture in the browser's cache. When you try to put the picture in the document, you can display it immediately. There will often be some image connections in the current web page. When the mouse pointing to it, the image replaces another image, which is pre-read image.</p> <p>JavaScript example of pre-reading image</p> <p>Var imagepreload = new image ();</p> <p>ImagePreLoad.src = '001.gif'; imagePreLoad.src = '002.gif'; imagepreLoad.src = '003.gif';</p> <p>The above example is suitable for reading a small number of pictures.</p> <p>Function imagePreeload () {var imgpreeload = new image (); for (i = 0; i <arguments.length; i ) {imgpreeload.src = arguments [i];}}</p> <p>ImagePreLoad ('001.GIF', '002.GIF', '003.GIF', '004.GIF', '005.gif');</p> <p>The above example is suitable for reading a large number of pictures.</p> <p><script src = "http://ad.nease.net/nnselect.js"> </ script></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-98748.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="98748" 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.046</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 = '_2Fkf4VVuWc1zxLqm7_2BRbFqp6_2BuCBQMg0_2BydWQNFyKZ2QggAiDmok_2FI8FibJ_2BT79G8cT_2FQfrvc9ENEwgYxoxYdQA_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>