Category:JavaScript

  • Complete example of JS document form form element operation

    Time:2020-7-13

    This paper describes the operation of JS document form form elements. For your reference, the details are as follows: <html> <head> < title > formform operation <meta charset=”UTF-8″/> <script type=”text/javascript”> function testForm(){ //The first way to get the form object is through ID, which is a common method var fm=document.getElementById(“fm”); Alert (FM); // output the […]

  • Ajax asynchronous upload file instance code sharing

    Time:2020-7-13

    I don’t want to say much. I’ll give you some dry goods. I’m sorry for the poor writing. The specific codes are as follows: <!DOCTYPE html> <html> <head> <meta name=”viewport” content=”width=device-width” /> <script src=”~/Scripts/jquery-1.8.2.min.js”></script> <title>Index</title> <script> $(function() { $(‘:button’).click(function () { var formData = new FormData(); var file = $(“input[type=’file’]”)[0].files[0]; formData.append(“files”, file); $.ajax({ url: ‘/Upload/Upload’, […]

  • Classes in TS

    Time:2020-7-13

    In addition to implementing the functions of all classes in ES6, typescript has added some new usages (part ES7). 1、 Main usage of classes in ES6: 1. UseclassDefining classes, usingconstructorDefine the constructor.adoptnewWhen a new instance is generated, the constructor is called automatically. 2. UseextendsKeyword implementation inheritance, subclass usesuperKeyword to call the constructor and method of […]

  • Using Vue to realize single selection and multiple selection of check box

    Time:2020-7-11

      Interface style: full name phone number Application time operation {{item.trueName}} {{item.phone}} {{item.addTime}} adopt reject No data available Key parameters: Hasallchecked select all method: //Select all chooseAll(val) { var self = this if (val) { self.applyUserList.forEach(ele => { ele.hasSelected = true }) } else { self.applyUserList.forEach(ele => { ele.hasSelected = false }) } }, Explanation: […]

  • The reason and solution of Ajax internal value cannot be called outside

    Time:2020-7-11

    The reason and solution of Ajax internal value cannot be called outside var id=‘123′; $.ajax({ url:’http://www.xxx.com/ajax’, type:’post’, dataType: “json”, data:{wurl:w_url,murl:m_url}, async : turn, error:function(){ }, success:function(data){ var id= data[‘id’]; console.log (ID) // here comes 100 } }) console.log (ID); // here comes 123 The problem lies in the async synchronization guide option of Ajax. If […]

  • JavaScript array sorting applet implementation analysis

    Time:2020-7-11

    This article mainly introduces the JavaScript array sorting small program to achieve parsing, the article through the example code introduced in very detail, for everyone’s study or work has a certain reference learning value, need friends can refer to The sort() function of JavaScript array is sorted by string size, which can’t sort a group […]

  • Simple operation complete example of JS document document

    Time:2020-7-10

    This paper describes the simple operation of JS document. For your reference, the details are as follows: <html> <head> < title > JS document structure operation <meta charset=”UTF-8″/> <script type=”text/javascript”> function testFile(){ //Get element var showdiv=document.getElementById(“showdiv”); //Add attribute, append element showdiv.innerHTML=showdiv . innerHTML + “< div > < input type: ‘file’ value = ‘” / […]

  • Comprehensive analysis of Ajax comprehensive application

    Time:2020-7-10

    Ajax, namely “asynchronous JavaScript and XML” (asynchronous JavaScript and XML), is a web development technology to create interactive web applications. Ajax = asynchronous JavaScript and XML (a subset of the standard common markup language). AJAX is a technology for creating fast dynamic web pages. Through a small amount of data exchange with the server in […]

  • Jsonp hijackin attack details

    Time:2020-7-10

    The Chinese meaning of jsonp hijackin is JSON hijacking, and the reason for JSON data hijacking is that the front end is attacked by cross site. Cross site = cross domain, cross domain literally means beyond the scope and field. Keep asking. What’s beyond that? What is the original scope? Understanding cross site attacks is […]

  • Detailed explanation of optimizing the performance of date format in Vue

    Time:2020-7-9

    In many projects, it is necessary to convert the long integer date format to other date formats. In Vue, we can customize the corresponding filter filter to perform the function of date format. If you directly introduce the method of moment, when using NPM run build — report, you will find that moment.js The file […]

  • Ajax upload of previewed multi images based on HTML5

    Time:2020-7-9

    1、 What about uploading picturesIn the age of XHTML, we can only upload one image at a time using the HTML file control. To upload more than one image at a time, the method is to use flash. for example swfupload.js 。 Unfortunately, the use of complex points, such as flash files and pages with […]

  • JavaScript appetizer

    Time:2020-7-9

    notes Single line comment: // shortcut key: Ctrl +/ Multi line comment: / * content * / shortcut key: Ctrl + Shift +/ variable Declarative variable var name; assignment name = ‘peach’; initialize variable var age=18; Update variables var age_age = 18; age_ Age = 20; // update Declare multiple variables var a=1, b=2, c=3; […]