Blog | 博客

postMessage – cross domain messaging

The window.postMessage() method allows scripts from one document to pass text messages to scripts in another document, regardless of whether they are cross-domain or not. Scripts in one document still cannot call methods and read properties in other documents, but they can communicate securely using this messaging technique. This technique is called “Cross Document Messaging”, […]

postMessage – cross domain messaging Read More »

js generates random numbers

js generates random numbers usually using the Math.random() function of javascript Several commonly used methods: Math.random() means: the result is between 0-1 (including 0, excluding 1); Math.floor(Math.random()*10+1) indicates that the result is a random number between 1-10 Math.floor(Math.random()*24) means the result is a random number between 0-23 1.Math.random(); returns a random number between 0-1, may

js generates random numbers Read More »

Two ways to get custom attributes in js

js to get two methods of custom attributes Four ways to get properties First get an element: var elem = document.getElementById(‘elem’); 1 1. Point (can not get custom attributes): 2. [] can also get attributes, which is beneficial for parameter transfer operations. elem.style[‘background’] = ‘yellow’ 1 3. getAttribute(): The early method of obtaining custom attributes.

Two ways to get custom attributes in js Read More »

The easiest way to get cookies in JS

const getCookie = (name) => document.cookie.match(`[;\s+]?${name}=([^;]*)`)?.pop(); // For example, the cookie is as follows: a=b; c=d // use getCookie(‘c’) // d where match is the prototype method for strings. str.match(regexp) If a non-regex object is passed in, it is implicitly converted to a RegExp using new RegExp(obj) The above, so there is no need to

The easiest way to get cookies in JS Read More »

Next.js 13 Released, Launching a 700x Faster Rust-Based Webpack Alternative

Next.js 13 is out now and some of the highlights include: app/Directory (beta): Simpler, faster, less client-side JS. Layouts React Server Components Streaming Turbopack (alpha): A 700x faster Rust -based alternative to Webpack. New next/image (stable) : native browser lazy loading faster. New @next/font (beta) : Automatic self-hosted font with zero layout offset. Improve next/link:

Next.js 13 Released, Launching a 700x Faster Rust-Based Webpack Alternative Read More »

when is the funniest joke

Original link: https://onojyun.com/2022/10/29/7651/ △ 302|When is the funniest joke It is a pity that the research indicated in the title itself has no meaning to the society, but I did research and draw conclusions on this topic just now. The scene is on the way to “listening to a class”, and I suddenly thought of

when is the funniest joke Read More »

Musk has taken over Twitter, many executives have been fired

Original link: https://www.williamlong.info/archives/6974.html According to the US “Washington Post”, citing sources, on the evening of the 27th local time, Tesla CEO Elon Musk’s $44 billion acquisition of Twitter has been completed, and he has gained control of the company. According to Bloomberg, according to the delisting notice from the New York Stock Exchange, Twitter will

Musk has taken over Twitter, many executives have been fired Read More »

Latest Weibo: October 28, 2022

Original link: https://www.changhai.org/articles/miscellaneous/blog/202210.php#d1028 Webmaster’s Weibo on October 28, 2022 This article is reprinted from: https://www.changhai.org/articles/miscellaneous/blog/202210.php#d1028 This site is for inclusion only, and the copyright belongs to the original author.

Latest Weibo: October 28, 2022 Read More »

Earnings report: Apple lives in another world; state-owned enterprise debt ratio continues to be lower than private economy

Original link: https://www.latepost.com/news/dj_detail?id=1362 Earnings report: Apple lives in another world In the face of a potential recession, foreign exchange storms, and various other risk events, Apple continues to do well. Compared to its peers, Apple seems to be living in a parallel world. Its privacy policy limits Facebook’s ability to monetize user data, indirectly affecting

Earnings report: Apple lives in another world; state-owned enterprise debt ratio continues to be lower than private economy Read More »

Gross profit per bicycle has increased from 800 to 10,000, and the advantages of BYD’s vertical integration are magnified by the environment

Original link: https://www.latepost.com/news/dj_detail?id=1363 Both revenue and profit increase, reflecting both boom and bust Few companies’ financial reports can reflect the contrasting boom and bust at the same time, but BYD can. Its listed entity, BYD Co., Ltd., currently has five major businesses: consumer electronics OEMs such as automobiles, mobile phones, and tablets. BYD’s consumer electronics

Gross profit per bicycle has increased from 800 to 10,000, and the advantages of BYD’s vertical integration are magnified by the environment Read More »