1. Select webpage ElementsThe basic design and usage of jQuery is to "select a webpage element and perform some operations on it ". This is the fundamental feature that distinguishes it from other function libraries.The first step of using jQuery is
Write a small instance today and use js and css to write a floating box that can be automatically hidden. Css must be used to control styles. js is used to control display and hide styles. There are two methods to display and hide: 1. Use js to
1. How to add attributes to an object? Method 1: var B = {};B ["name"] = "test ";Delete B. name: delete Object AttributesMethod 2: B. name = "test ";2. How do I determine whether a variable is declared?Typeof (a) = "undefined"Typeof (d) = "function"
After the image is queried, you also need to add a function to view the large image, so you write a method in js and then call this method in the onmouseover event of the image, in this way, the large image is automatically displayed when the mouse
When converting Javascript values and strings, you can operate on different hexadecimal values.The conversion example is as follows:Copy codeThe Code is as follows: convert the incoming value and string
How to Control embedded iframe scrolling in pages? The method is to use the scroll method of iframe window:1. Get the window object of iframeVar iwin = document. getElementById ('iframe1'). contentWindow;2. Get the window document Object of
Javascript native does not support namespaces and needs to be implemented with modifications.
When we create a JavaScript library, the namespace becomes very important. We can combine the scattered JavaScript files in this JavaScript Library (*. js)
Copy codeThe Code is as follows:// ConstructorFunction person (name, age ){This. name = name;This. age = age;}// Define the person prototype. attributes in the prototype can be referenced by custom objects.Person. prototype = {GetName: function
Jquery1.10 removes the. live () method and adds a. on () method to bind events to the element. The usage is as follows:On (events, [selector], [data], fn)Copy codeThe Code is as follows:$ ("# DataTable tbody tr"). on ("click", function (event
Obtain the absolute X and Y coordinates of an element on the page. You can use the offset () method:Copy codeThe Code is as follows: var X =$ ( '# divid' ) . offset ( ) . top ; var Y =$ ( '# divid' ) . offset ( ) . left ; Obtain
Oninput, onpropertychange, onchange usage
The onchange trigger event must meet two conditions:
A) the attributes of the current object are changed and triggered by keyboard or mouse events (the script trigger is invalid)
B) The current object loses
Copy codeThe Code is as follows:Function moveToRight (select1, select2) // move the selected value to the right. sleect1 and sleect2 are the IDs of the drop-down list box, respectively.{$ ('#' + Select1 + 'option: selected'). each (function (){$ (""
If the position of the parent div is defined as relative, and the position of the child div is defined as absolute, then the style of the Child div. the left value is relative to the parent div value, which is the same as offsetLeft, the difference
Javascript anonymous function, that is, a function has no name. The test code is listed below.Copy codeThe Code is as follows:/** This is a common function.*/Function debug (data ){Console. log (data );} But some functions are written like this.Copy
1) Disable right-clickWhen developing a Web application, you must disable the right-click function in some cases. With this code, jQuery developers can disable right-click on the webpage. The Code is as follows:Copy codeThe Code is as follows:$
The following code block will always make the pop-up div in the center of the screen. I hope it will help you!Copy codeThe Code is as follows:// Make the specified DIV always display in the center of the screenFunction setDivCenter (divName ){Var
The Code is as follows:Copy codeThe Code is as follows:PageEncoding = "gbk" %>
Insert title here
"/>Click + to add + to textarea. Click-to add-to textarea;
I have used printf debugging before, and it seems that I can always solve the bug faster since then.
In some cases, better tools are needed. Below are some of the best of them. I am sure you will find them useful:
1. debugger;
As I mentioned earlier,
HTML5, CSS3, and Javascript can help object-oriented developers develop games with various features, such as 3D animation effects, Canvas, mathematics, color, sound, and WebGL. The most obvious advantage is that HTML5-developed games can run on any
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service