During the Javascript application process, we will encounter various comparisons. Today, I have compiled three situations for you and learn them together. 1. Comparison of two objects. Javascript has mixed some strange features. Let's take a look at s
Dragging is a very cool thing. You click on an object, hold down the mouse, move the mouse to another area, and release the mouse button to place the object here. Here is a simple case: HTML part: Note that dragging elements must be defined in absolute te
1. Ajax(Asynchronous JavaScript + XML) can request additional data like the server without uninstalling the page, that is, local refresh technology 2. Create an XHR object function createXHR () { if (typeof XMLHttpR
There are 100 steps, which can take 1 step or 2 steps, so how many ways do one walk? Today is the phone interview. When I encountered an algorithm problem, I was confused in an instant; then I was smart and thought that if a person took 1 step every time,
The first method here is to use JavaScript to convert the number number into the format of a currency string (parameters: preserve the decimal places, currency symbols, integer part of the thousand separator, decimal separator). The second method here is
Such basic things should not be recorded anymore, but, review the past and learn new things~ Let's start with the data type js six major data types: number, string, object, Boolean, null, undefinedstring: Explained by single or double quotes, such as
Without further ado, I will just post code to everyone. <script>$(function () {//highlight current / active link 左侧导航判断当前活动导航$('ul.main-menu li a').each(functio
I wrote a test code and used require.js to cooperate with its plug-in text.js to implement the simplest single-page application. It can be recorded easily and is convenient for future review. git address: https://github.com/lily1010/requireSPA. Let's
There is no strict pause or restart for JavaScript timers, only clear stop, but allChild[index].onclick = function(){// When clicking on the target and the following conditions are met, the timer time is paused if(g
AngularJS routing is essential for single-page applications to jump from one view of the page to another. As applications become more and more complex, we need a reasonable way to manage the interfaces that users see during use. AngularJS is to break up v
This article shares the animation code for js to implement parabola and add shopping cart for your reference. The specific content is as follows parapola.js/*! * by zhangxinxu(.com) 2012-12-27 * you can visit http://www.zhan