HTML5,Javascript,andjQuery24-HourTrainer(2)-some simple tags
<html lang=”en”><head> <meta charset = “utf-8″> <title> Sugar’s page > </title></head> <body> <h1>This is the first header</h1> <p> This is a paragraphs. <br> This is a next line <br> Hi! </p> <blockquote>> It’ a lone life. <cite>By sugar</cite> </blockquote> <p>Click me <a href=”2.html”> here</a> to view a page</p> <p><a href=”http://www.baidu.com”>Baidu </a></p> <p> <img src=’1.jpg’ title=”a text” width=”200″> </p> <p> <a href=”http://www.baidu.com”><img src=’1 .jpg’ width=”200″/></a> </p></body></html> Output effect:
JavaScript, timer output problem
1. The output problem of timer setTimeout with document.write() 1234567 var index = 0; function fn() { document.write(index); index++; setTimeout(fn,1000); -wrap”> Please note that the first number is 1In other words, 0 is covered. What is the reason?
What are the uses of Java, Python, Javascript, and PHP that are very popular now?
The purpose of developing programs in any programming language is to let the computer do work, such as writing an article, downloading an MP3, etc. And the CPU of the computer only works Understand machine instructions. So ,Although different programming languages are very different,In the end, they all have to be “translated” into machine instructions that the CPU can execute. In theory, any language can do almost anything – but the main purpose is different. For those who have just entered the IT industry ,maybe they only know how much the salary is for a certain language, But I don’t know what my main job is and I don’t think about the future career development direction. What are Java, Javascript, C, C++, PHP, and Python used to develop? These programming languages will be explained in detail below. C and C++ C/C++Theoretically you can do any development,as long as you have the right hardware Drivers and APIs are characterized by high efficiency and are basically the most efficient among compiled languages. Unless your system doesn’t even have a C/C compiler. In some systems, the C compiler is not available, but C is generally available. At present, the C language is mainly…
javascript, why does it obviously have a value, but it is displayed as null
java ip ide Write your review! Come on, watch it all Member login | User registration Recommended reading ide java fx menu_DOC0324 menu (Menu) DOC-03-24 Menu (Menu) This chapter will introduce how to create a menu (Menu) and menu bar (MenuBar), add menu items (MenuItem), and group menus,… [detailed] Crayon Shin-chan 2023-09-23 01:37:23 web How bad is the front end? Recently, I feel that I can’t keep up with the development of the front end, so I wrote an article to sigh. I know that there are some schools that teach some simple web page production, the kind that uses Dreamweaver to make a few clicks. Most of them also leave their homework behind, and when they finally hand it in they look like a model… [detailed] Crayon Shin-chan 2023-09-23 01:21:49
Replace escape character, javascript, regexp – replace escape character, javascript, regexp
I want to replace this this str: ‘FL\X\KT’ to this ‘FLÄKT’. I want to replace this str: ‘FL\X\KT’ with ‘FLÄKT’. Tried this: str.replace(/\\X\\/g, ‘Ä’); Tried this: str.replace(/\\X\\/g,’Ä’); But this just removes the backslashes. But this just removes the backslashes. Any ideas? Any ideas? 2 solutions #1 1 str =’FL\\X\\KT’; str.replace(/\\X\\/g, ‘Ä’); One more example to illustrate this more clearly, you can use alert instead of console.log if you want: One more example to illustrate this more clearly, you can use alert instead of console.log if you need: FL\X\KT #2 0 The \ is treated as a escape character, so you can use just: \ is considered an escape character, so you can use: str = str.replace(/X/g, ‘Ä’); DEMO DEMO This will work on simple string where you want to replace X wit Ä. However if you have more imput, also containing X which you don’t want to replace, I think you can try with something like: This will work for simple strings where you want to replace X wit. But if you have more input that also contains X’s that you don’t want to replace, I think you could try something like: var str = unescape(“FL\\X\\KT”); str = str.replace(/\\X\\/g, ‘Ä’);…
Web basic knowledge points (html, css, http, javaScript)
1.htmlBasic Knowledge HTML is not a programming language, but a markup language used to tell the browser how to organize a page. 1. Element The start tag + content + end tag is a complete element. But empty elements only have start tags. For example: the element is used to insert a specified picture at the location of the element . 2. Nested elements Elements can be placed within other elements – this is called nesting set. For example: I love my Motherland The tag is used here to emphasize the content of the motherland. 3. Introduction to common elements (1.) Title to (2.) Paragraph (3.) List List with serial number: List without serial number: (4.) Hyperlink (5.) Image (6.) Block-level semantic element None Semantic elements are usually used to organize content so that it can be laid out or manipulated through CSS or JS later. (7.) Inline semantic-less elements 4. Document structure 5.htmlComments 2.cssbasicknowledge Fullname:CascadingStyleSheets->CascadingStyleSheets Definition:CSSbecomesacascadingstylesheet,whichismainlyusedtosetthetextcontent(font,size,alignment,etc.),theshapeoftheimage(widthandheight,borderstyle,margins,etc.)intheHTMLpage,andThelayoutofthelayoutandotherappearancedisplaystyles.CSSisbasedonHTMLandprovidesawealthoffunctions(suchasfont,color,backgroundcontrol,overalllayout,etc.),andcanalsosetdifferentstylesfordifferentbrowsers. TherelationshipbetweenHTML,CSSandJS HTMLisamarkuplanguagethatisusedtostructurethecontentofourwebpagesandgivethecontentmeaning.Forexample,defineparagraphs,headings,anddatatables,orembedimagesandvideosintopages. CSSisastyleruleslanguagethatcanbeusedtoapplystylestoHTMLcontent,suchassettingbackgroundcolorsandfonts,andlayingoutcontentinmultiplecolumns. Javascriptisascriptinglanguagethatcanbeusedtocreatedynamicallyupdatingcontent,controlmultimedia,animateimages,andmuchmore. 3.BasicknowledgeofJavascript WhatisJavascriptcisascript,aprogramminglanguage,whichcanComplexfunctionsareimplementedonwebpages.Whatwebpagesshowyouisnolongersimplestaticinformation,butreal-timecontentupdates,interactivemaps,2D/3Danimations,scrollingvideos,etc.HowtoaddJavascripttoapageJavascriptcanbeaddedtoanHTMLpagejustlikeCSS.CSSusestheelementtolinktoexternalstylesheets,andtheelementtoembedinternalstylesheetsintoHTML.Javascriptonlyneedsoneelementhere-.Javascriptrunsequence AfterthecollectionofHTMLandCSSisassembledintoawebpage,thebrowser’sJavascriptengineexecutestheJavascriptcode.ThisensuresthatthestructureandstylingofthewebpagearealreadyinplacebeforetheJavascriptstartsrunning. WhenthebrowserexecutesapieceofJavascriptcode,itusuallyexecutesthecodefromtoptobottom.Thismeansyouneedtopayattentiontotheorderinwhichyourcodeiswritten. 4.KnowledgerelatedtoHTTPprotocol HTTPprotocol(HyperTextTransferProtocol),whichisbasedontheapplicationlayerofTCPprotocolThetransmissionprotocolissimplyarulefordatatransmissionbetweentheclientandtheserver.url http协议格式 5.Requestformat 6. Response format The format of the HTTP response is except for the status line (first line) and Except for the different request lines, the format is the same 7.Commonrequestmethodsandmeanings 8.…
JavaScript, re-understand Array by analyzing Array.prototype.push
When reading the ECMAScript documentation, I noticed that the push method of an array is not limited to use in arrays, and is reserved as a general method. Does it mean that it can also be used in some array-like places? As for what is very similar to an array, you may immediately think of the Object object. Because Array inherits from Object, you can use [] instanceof Object and you will find that true is returned. Of course everyone knows this and this is nothing new. Then we can try it boldly. What will happen if we apply the push method of the array to the object? We use call to point the value of this to obj, and then push. It can be found that there is an extra ‘0’: ‘zero’ and the ‘length’ attribute of the array in the obj object! We all know that general objects do not have a length attribute, so when we want to know how many attributes an Object has, we generally use for in to iterate the object. You can know that the length attribute is passed in internally by the Array.prototype.push method. To get closer to our idea, we…
JavaScript, jQuery, get the day before the current date
var now = new Date(); now = new Date(now.getTime() – 86400000); var year= now.getFullYear() , mOnth= (now.getMonth() + 1).toString(), day = now .getDate().toString(); if (month.length == 1) { mOnth= ‘0’ + month; } if (day .length == 1) { day = ‘0’ + day ; } var dates=(year+ ‘-‘ + month+ ‘-‘ ; + day ); console.log(dates);//Previous day
Javascript, move elements in an array from front to back
I have an array containing variables and functions. The array is 80 elements long. The first 20 elements are used together in a for loop. After the loop completes, the first 20 elements are moved to the back of the array and the for loop starts again. I am rebuilding the array this way: var a2=[the array with 80 elements];run(a2);function run (array){ var n=array.slice(0,20); array.splice(0,20); var con=array.concat(n); a2=con; } So I basically index the (new) slice array, re-index the (original) array after concatenation, index the (new) array after concat, and after I set it to Reindex the original array again when concating. This seems too inefficient. Is there a more mature way? Workaround: You don’t need slice() then splice(). Splice() returns the removed elements, so you just need to do this: var n = array.splice(0, 20);a2 = array.concat(n); To be completely clear, Javascript’s splice( ) method returns the removed elements, not the remaining ones. Also, using global variables is generally a bad idea, but you’re also kind of mixing them up in a weird way. If you’re keeping variables Globally, I would pass the original in as a parameter and return the result of the function: var a2=[the array with…
Chapter 111, JavaScript, BOM Browser Object Model
Javascript, BOM Browser Object Model Learning points: 1.window object 2.location object 3.history object BOM is also called the browser object model. It provides many objects for accessing browser functions. BOM lacks specifications, and each browser provider extends it according to its own ideas. Then browser-shared objects become the de facto standard. Therefore, there is no standard for BOM itself or there is no organization to standardize it. 1. windowobject, browser object The core object of BOM is window, which represents an instance of the browser. The window object is at the top level of the Javascript structure. For each open window, the system automatically defines the window object. 1.Window is the top-level object2. The window object has six attributes, and these six attributes themselves are also objects 3. The document attribute under the window object is also an object, and the document object has five attributes, and these five attributes themselves are also objects4. Summary. They are all objects 1. Object properties and methods The window object has a series of properties, which are themselves objects Properties of window object Properties Meaning closed True when window is closed defaultStatus The default status message displayed in the status bar at the…